Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
brief001
Helper II
Helper II

If-Else DAX formula with hours total per day

 

I have a table that shows how many hours an employee works per day. The data contains multiple records for one day, so this must be added up to a day total. Now I am looking for a DAX measure that returns the value 1 if the day total is 8h, and returns the value 0 if the day total is not equal to 8h. (In the picture you see the desired result as column 'measure' at the bottom right).

 

Also wants to be able to count how many days an employee was in the data PER DAY. (In the picture you see the desired result as column 'Days' at the bottom right).

 

Example.JPG

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

@brief001 , you might want to try

 

Days = DISTINCTCOUNT ( Attendance[Date] )

Measure = 
SUMX (
    DISTINCT ( Attendance[Date] ),
     ( CALCULATE ( SUM ( Attendance[Hrs] ) ) >= 8 ) + 0
)

 

Screenshot 2021-03-15 221330.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

I have been helped on my way. But I haven't gotten to the full solution yet. Ultimately, I want reports on how many days per employee the 8h was achieved, plus how many measurements took place.

 

Below you can see the number in red that I would like to have reported.

Where the end goal is the table on the right. The two pictures to the left are only needed to report detailed insight.
Voorbeeld.JPG

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (27)