Search code examples
sql-serverpowerbireportpowerquery

Power BI Bar char with time text values


I have a table with the following data

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

The time have been converted to text value in SQL query before I import it in Power BI. When I tried to create a bar chart with the text value I created a measure based on the time

timesValue = MAX(Products[Times])

When I place them in my visual I can't see any value

enter image description here

My expected output is

enter image description here


Solution

  • My solution for this:

    First create a new column from your StringTime column

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

    Then change format to

    ##:##
    

    enter image description here