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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Jos13
Helper III
Helper III

Cannot format measure

Hi All,
I was trying to format total duration in hh:mm:ss format in a matrix visual.

Jos13_0-1622021399472.png

I wanted to show those employees with duration>100 sec or transactions>20. 
I could create a measure for duration logic but when I format it to hh:mm:ss, it gives me 0.
I also want to exclude employees with blank in both duration and transaction.

Please help me on this.

Power bi file
https://drive.google.com/file/d/1MrKuxlT-hocLWRQK5kMujW3J-RRd2-Za/view?usp=sharing

 

 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Jos13 ,

 

Please try this:

Measure = 
var _hour=TRUNC([Total Duration]/3600)
var _min= TRUNC(  MOD([Total Duration],3600)  /60)
var _sec=MOD( MOD([Total Duration],3600),60)
return IF([Total Duration]>100 || [Total Transactions]>20 , TIME(_hour,_min,_sec),BLANK())

After uncheck the Show items with no data options, the final output is shown below:

Duration to time.PNG

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @Jos13 ,

 

Please try this:

Measure = 
var _hour=TRUNC([Total Duration]/3600)
var _min= TRUNC(  MOD([Total Duration],3600)  /60)
var _sec=MOD( MOD([Total Duration],3600),60)
return IF([Total Duration]>100 || [Total Transactions]>20 , TIME(_hour,_min,_sec),BLANK())

After uncheck the Show items with no data options, the final output is shown below:

Duration to time.PNG

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Jos13 , for duration first have measure

 

Total duration = sum(Table[duration])

 

Duration as Duration =Quotient([Total duration ],3600) &":" & Quotient(mod([Total duration ],3600),60) &":" & mod(mod([Total duration ],3600),60)

 

Filter > 100

 

Sumx(filter(summarize(Table, Table[reporting to] , Table[Employee], "_Duration" , [Total duration],"_trans",[Total Transactions] ) , _Duration >100 && _trans >20),[_Duration])

 

Again use the duration code

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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