The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I have a table of employees where I need to calculate the difference between predicted hours and actual hours. Taking into account that there can be negative hours (when the predicted time is greater than the actual time), how can I do a dax measurement to calculate this value without Power BI changing the time format?
In the case of the example, I would like to show: -19:33:57
Solved! Go to Solution.
@pedromenu Generally you will need to convert those to seconds, add/subtract them and essentially convert them back more or less. And use a custom format string to preserve the format. Sample source data would help here to be more specific.
Look at the links below, they should get you what you need.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639#M389
https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486
https://community.powerbi.com/t5/Quick-Measures-Gallery/Duration-to-Seconds-Converter/m-p/342279#M92
@pedromenu Generally you will need to convert those to seconds, add/subtract them and essentially convert them back more or less. And use a custom format string to preserve the format. Sample source data would help here to be more specific.
Look at the links below, they should get you what you need.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639#M389
https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486
https://community.powerbi.com/t5/Quick-Measures-Gallery/Duration-to-Seconds-Converter/m-p/342279#M92
User | Count |
---|---|
15 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
24 | |
20 | |
12 | |
10 | |
7 |