Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
whitej
Frequent Visitor

Using time data type as a value in bar chart

I have a column showing seconds (whole numbers) and would like to convert it to hh:mm and use it in a bar chart with date on the Y axis. Is it possible in Power BI? I have managed to create a column with hh:mm but when pulled into the value field it only displays the count.

 

Thank you

 

James

9 REPLIES 9
amitchandak
Super User
Super User

@whitej , New time column

time = time(time(Quotient([Col],3600) ,Quotient(Mod([Col],3600),60) ,mod(mod([Col],3600),60)) )

 

Add with date if needed

 

Date time = [Date] +[Time]

 

Use on axis

 

 

Also I need to be able to use the new column as a value and not on an axis

I am getting this error when creating the new column

 

whitej_1-1631795824915.png

 

@whitej See Chelsie Eiden's Duration, I created it for this exact scenario: Chelsie Eiden's Duration - Microsoft Power BI Community


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Do I need to create a new column or measure for this to work?

 

Thank you

Hi, @whitej 

 

What's your original column and what do you want to change to? Can you share some sample data? So we can help you soon.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.


Best Regards,

Community Support Team _ Janey

So I have created a new measure called Duration Engineering Done to convert seconds to hh:mm:ss and it looks fine.

 

whitej_0-1632394332276.png

 

But I only want to see hh:mm. So if I change the Format at the top to 00:00 and remove the "seconds" in the dax then I am getting the following. 

 

What I want to see is:

 

01-Jul-21 01:26

02-Jul-21 00:10

 

 

whitej_1-1632394662400.png

 

 

Great, thank you. Moving in the correct direction. I just had to remove the SUM from VAR Duration = SUM[Duration[

 

Also do not need the seconds so this is what I have done but having a slight problem when changing the fromat from 00:00:00 to 00:00. Looking at my DurationTime Column there is no : between my hour and my minute. Anything I can do to fix this?

 

 

 

whitej_2-1631798725127.png

 

 

 

whitej_1-1631798668101.png

 

 

 

Another way to do what you want is to keep your duration column as a decimal, create two measures (one for your total decimal, and one with that formatted as "hh:mm"), and use the Charticulator visual to make your chart.  You would use the text measure in a text box label at the top of the bars.

(15) Austin Power BI User Group - Charticulator 101 - YouTube

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors