Forum Discussion

Divyanshkapoor's avatar
Divyanshkapoor
New Member
3 years ago

need dax help

Scenario:

I have a report that needs me to calculate the frequency of absenteeism impact per employee. The condition is, 1 date will be count as 1, and consecutive date will also be count as 1. If the consecutive date involve 2 different week, then it will be count as 2 and not 1. If 1 date (non-consecutive) and a consecutive dates appear on the same week, the sum of frequency will be 2.

 

 

dax 

1 Reply

  • You can try this DAX :

    Absenteeism Frequency = 

    VAR PreviousDate = MIN('YourTable'[Date]) - 1

    RETURN

    SUMX(

        FILTER('YourTable',

            'YourTable'[Employee] = SELECTEDVALUE('YourTable'[Employee]) &&

            ('YourTable'[Date] - PreviousDate > 1 ||

            WEEKNUM('YourTable'[Date]) <> WEEKNUM(PreviousDate))

        ),

     

        1

    )