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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi All,
I'm looking for a if and time dax statement that gives me the total count of rows in Table[Order Time] that are less than 10am as "breakfast" and greater than 10 as "Lunch".
Thank you in advance!
breakfast =
CALCULATE (
COUNTROWS ( 'fact' ),
FILTER (
'fact',
TIMEVALUE ( CALCULATE ( MAX ( 'fact'[Value] ) ) ) <= TIME ( 10, 00, 00 )
)
)
lunch =
CALCULATE (
COUNTROWS ( 'fact' ),
FILTER (
'fact',
TIMEVALUE ( CALCULATE ( MAX ( 'fact'[Value] ) ) ) > TIME ( 10, 00, 00 )
)
)
@am_i_really Try:
Breakfast =
VAR __Table = ADDCOLUMNS('Table',"__Hour",HOUR([Order Time]))
VAR __Result = COUNTROWS(FILTER(__Table,[__Hour] < 10))
RETURN
__Result
Lunch =
VAR __Table = ADDCOLUMNS('Table',"__Hour",HOUR([Order Time]))
VAR __Result = COUNTROWS(FILTER(__Table,[__Hour] >= 10))
RETURN
__Result