带有时间文本值的 Power BI 条形图

Power BI Bar char with time text values

我有一个 table 具有以下数据

create table #tbl (Product varchar(20),dates Datetime)
insert into #tbl values 
('Fan','2014-09-15 07:24:37.460'),
('Byke','2015-11-15 01:46:07.460'),
('Book','2017-05-25 12:52:37.670'),
('Pencil','2015-12-30 17:48:07.530'),
('Shoes','2016-09-05 12:13:19.600')
select
Product,
format(dates,'MM:ss') AS Times
from #tbl
drop table #tbl

在我将其导入 Power BI 之前,时间已在 SQL 查询中转换为文本值。当我尝试使用文本值创建条形图时,我创建了一个基于时间的度量

timesValue = MAX(Products[Times])

当我将它们放在我的视觉对象中时,我看不到任何值

我的预期输出是

我的解决方案:

首先从您的 StringTime 列创建一个新列

Column = INT(SUBSTITUTE('Table'[times],":",""))

然后将格式更改为

##:##