Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Is there a way to calulate two different measures, one for hours used and one for hours remaing? All users start of with 40 hours remaining. The difference between end date and start date represents the hours used.
User ID | Start Date | End Date |
111 | 9/01/2022 9:00:00 AM | 9/01/2022 5:00:00 PM |
112 | 9/05/2022 8:00:00 AM | 9/05/2022 4:00:00 PM |
112 | 9/06/2022 8:00:00 AM | 9/06/2022 4:00:00 PM |
Solved! Go to Solution.
Hi @EMassicot ,
Approve with @Gianluca88 , You can use Datediff().
Please try:
Hours used =
VAR _a =
ADDCOLUMNS (
FILTER (
ALL ( 'Table' ),
[User ID] = MAX ( 'Table'[User ID] )
&& [End Date] <= MAX ( 'Table'[End Date] )
),
"Hours used", DATEDIFF ( [Start Date], [End Date], HOUR )
)
RETURN
SUMX ( _a, [Hours used] )
Hours remaining = 40-[Hours used]
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @EMassicot ,
Approve with @Gianluca88 , You can use Datediff().
Please try:
Hours used =
VAR _a =
ADDCOLUMNS (
FILTER (
ALL ( 'Table' ),
[User ID] = MAX ( 'Table'[User ID] )
&& [End Date] <= MAX ( 'Table'[End Date] )
),
"Hours used", DATEDIFF ( [Start Date], [End Date], HOUR )
)
RETURN
SUMX ( _a, [Hours used] )
Hours remaining = 40-[Hours used]
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
78 | |
58 | |
36 | |
33 |
User | Count |
---|---|
96 | |
62 | |
56 | |
49 | |
41 |