【问题标题】:Power BI Bar char with time text values带有时间文本值的 Power BI 条形图
【发布时间】:2021-06-01 19:43:58
【问题描述】:

我有一个包含以下数据的表格

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])

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

我的预期输出是

【问题讨论】:

    标签: sql-server powerbi report powerquery


    【解决方案1】:

    我的解决方案:

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

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

    然后将格式改为

    ##:##
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多