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
Anonymous
Not applicable

Issue with Column Dax

Hi Community,

I need a small & quick help, its probably something too simple.

My matrix on the report looks like following: I have a calender table that is linked to my data table:

 

Capture_2032.PNG

Leaves in hrs is calculated from two columns 'Start_date' & end_date' which are the dates of leaves taken. I converted the number of leaves take(in days) to Hours.

Hrs_worked = hrs_per_month - Leaves in Hrs

Hrs_worked is a column. The issue is I can't get the Hrs_worked right where there is more than one 'Leaves in hrs' (hrs worked in blue are expected hours_worked).

Please suggest how can I get the right Hours_worked.

My pbi:  https://1drv.ms/u/s!Ag919_pO_UKrgRJuluqNoYvl-Zba?e=NynFhy

TIA

1 ACCEPTED SOLUTION
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

Try it

Hours worked =
VAR Curemp = HASI_Wrkhrs[emp_code]
VAR CurMonth =
    MONTH ( HASI_Wrkhrs[date_start] )
RETURN
    HASI_Wrkhrs[Hrs per month]
        - CALCULATE (
            SUM ( HASI_Wrkhrs[Leaves in hrs] ),
            FILTER (
                HASI_Wrkhrs,
                HASI_Wrkhrs[emp_code] = Curemp
                    && MONTH ( HASI_Wrkhrs[date_start] ) = CurMonth
            )
        )

View solution in original post

1 REPLY 1
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

Try it

Hours worked =
VAR Curemp = HASI_Wrkhrs[emp_code]
VAR CurMonth =
    MONTH ( HASI_Wrkhrs[date_start] )
RETURN
    HASI_Wrkhrs[Hrs per month]
        - CALCULATE (
            SUM ( HASI_Wrkhrs[Leaves in hrs] ),
            FILTER (
                HASI_Wrkhrs,
                HASI_Wrkhrs[emp_code] = Curemp
                    && MONTH ( HASI_Wrkhrs[date_start] ) = CurMonth
            )
        )

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors