Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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 |
---|---|
81 | |
76 | |
61 | |
37 | |
33 |
User | Count |
---|---|
99 | |
56 | |
51 | |
42 | |
40 |