Forum Discussion

Compacted's avatar
Compacted
New Member
4 years ago
Solved

Power bi dates diff conditional count

I am new to power bi and i need to count the number of times that a employee has the same issue code in less than 50 days. Employee | Code | Date 01 | 101 | mm/dd/yyyy 02 | 101 | mm/dd/yyyy 03 | ...
  • v-zhangti's avatar
    4 years ago

    Hi, Compacted 

     

    As you said, if your data sets are less than 50 days, you can count directly.

    1. Calculated column

     

    Count =
    CALCULATE (
        COUNT ( 'Table'[ Code ] ),
        FILTER (
            'Table',
            'Table'[Employee ] = EARLIER ( 'Table'[Employee ] )
                && 'Table'[ Code ] = EARLIER ( 'Table'[ Code ] )
        )
    )
    

     

     

     2. Measure

     

    Measure =
    CALCULATE (
        COUNT ( 'Table'[ Code ] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Employee ] = MAX ( 'Table'[Employee ] )
                && 'Table'[ Code ] = MAX ( 'Table'[ Code ] )
        )
    )
    

     

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.