cancel
Showing results for 
Search instead for 
Did you mean: 
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

 

 



New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!

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!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Learn Power BI 2nd Edition

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
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors