Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone,
First time I couldn't find the answer directly on the forum, I will need the help of the community on this one !
I am working with data coming from multiple files that I merge in PBI.
At the end, my data looks like this :
| Day | Time | Status | Duration |
| Day 1 | 8:00 | A | 54 |
| Day 1 | 8:54 | B | 80 |
| Day 1 | 10:14 | A | 200 |
| Day 1 | 13:34 | A | ... |
| Day 1 | 15:55 | B | |
| Day 2 | 8:05 | A | |
| Day 2 | ... | A | |
| Day 2 | B | ||
| Day 2 | 16:15 | B | |
| Day 3 | 7:55 | A | |
| Day 3 | A | ||
| Day 3 | B | ||
| Day 3 | B | ||
| Day 3 | B | ||
| Day 3 | 17:10 | A |
I am trying to calculate the sum of the opening time of each day, so the difference between the minimum hour of the day (8:00 on day 1 for example), and the maximum hour of the day (15:55 for day 1 for example).
So I can easily make it work with MAX(Time)-MIN(Time) for a specific Day, but when I want to do it for multiple days I can't figure it out. I need to exclude the closed time inbetween the days, like between 15.55 on day 1 and 8.05 on day 2.
Between day 1 and day 2, the result will have to be 7:55 + 8:10 = 16:05 of opening time. But with the min max function, I will get 40:15 ... So i need to restrict it by day somehow.
Thanks for helping out,
Solved! Go to Solution.
Hi @LEPR ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create two measures.
open time =
var _min =MINX(FILTER(ALL('Table'),'Table'[Day]=MAX('Table'[Day])),'Table'[Time])
var _max=MAXX(FILTER(ALL('Table'),'Table'[Day]=MAX('Table'[Day])),'Table'[Time])
return _max-_minsum = SUMX(ALLSELECTED('Table'[Day]),'Table'[open time])
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Clearly show the result you are expecting. Also, if you have a Date column, share that as well.
Hi @LEPR ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create two measures.
open time =
var _min =MINX(FILTER(ALL('Table'),'Table'[Day]=MAX('Table'[Day])),'Table'[Time])
var _max=MAXX(FILTER(ALL('Table'),'Table'[Day]=MAX('Table'[Day])),'Table'[Time])
return _max-_minsum = SUMX(ALLSELECTED('Table'[Day]),'Table'[open time])
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!