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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hi All,
I am stumped. I have a column that does this:
Solved! Go to Solution.
sometimes you want to roundup, sometimes you want to rounddown. Then you need to use switch to list all the senarios.
pls see the DAX below
Proud to be a Super User!
Hi @Nicci ,
I create a table and a calculated column as you mentioned.
Then I think you can create another calculated column and use this DAX code.
RoundedHours =
VAR TotalMinutes = DATEDIFF(HearingsScheduled[StartTime], HearingsScheduled[EndTime], MINUTE)
VAR DecimalHours = TotalMinutes / 60
VAR MinutesPart = MOD(TotalMinutes, 60)
VAR RoundedMinutes =
SWITCH(
TRUE(),
MinutesPart >= 7 && MinutesPart < 22, 0.25,
MinutesPart >= 22 && MinutesPart < 37, 0.50,
MinutesPart >= 37 && MinutesPart < 52, 0.75,
MinutesPart >= 52, 1,
0
)
RETURN
INT(DecimalHours) + RoundedMinutes
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Nicci ,
I create a table and a calculated column as you mentioned.
Then I think you can create another calculated column and use this DAX code.
RoundedHours =
VAR TotalMinutes = DATEDIFF(HearingsScheduled[StartTime], HearingsScheduled[EndTime], MINUTE)
VAR DecimalHours = TotalMinutes / 60
VAR MinutesPart = MOD(TotalMinutes, 60)
VAR RoundedMinutes =
SWITCH(
TRUE(),
MinutesPart >= 7 && MinutesPart < 22, 0.25,
MinutesPart >= 22 && MinutesPart < 37, 0.50,
MinutesPart >= 37 && MinutesPart < 52, 0.75,
MinutesPart >= 52, 1,
0
)
RETURN
INT(DecimalHours) + RoundedMinutes
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
sometimes you want to roundup, sometimes you want to rounddown. Then you need to use switch to list all the senarios.
pls see the DAX below
Proud to be a Super User!