The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
28 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |