Forum Discussion
Need help with DAX
- Anonymous2 years ago
Hi Anonymous ,
I read your requirements and I do some changes with my DAX code.
Column = VAR _A = SUMX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[EmpID] = EARLIER ( 'Table'[EmpID] ) && 'Table'[week_Key] <= EARLIER ( 'Table'[week_Key] ) ), 'Table'[Working hours on that week] ) / SUMX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[EmpID] = EARLIER ( 'Table'[EmpID] ) && 'Table'[week_Key] <= EARLIER ( 'Table'[week_Key] ) ), 'Table'[Count of week (1 if no absences)] ) RETURN IF ( 'Table'[Count of week (1 if no absences)] = 0, 0, _A )Then you will get what you want.
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 Anonymous ,
I read your requirements and I do some changes with my DAX code.
Column =
VAR _A =
SUMX (
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[EmpID] = EARLIER ( 'Table'[EmpID] )
&& 'Table'[week_Key] <= EARLIER ( 'Table'[week_Key] )
),
'Table'[Working hours on that week]
)
/ SUMX (
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[EmpID] = EARLIER ( 'Table'[EmpID] )
&& 'Table'[week_Key] <= EARLIER ( 'Table'[week_Key] )
),
'Table'[Count of week (1 if no absences)]
)
RETURN
IF ( 'Table'[Count of week (1 if no absences)] = 0, 0, _A )
Then you will get what you want.
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.
Hello Anonymous ,
I don't think this DAX will work as the Week_key comes from DimDate, EmpID comes from DimEmp and WorkingHours, absenceHours and FixedWorkingTime come from FactTable.
Could you help me with DAX according to the above conditions?
regards,
Mahesh