Forum Discussion

StephenGW's avatar
StephenGW
Helper II
5 years ago
Solved

Count by criteria

Hello all,   I'm pretty good with spreadsheet formulae but I'm struggling with measures. I have a large data table with a few columns. Area, Audit Date, and Pass/Fail. What I need for a measure is ...
  • v-angzheng-msft's avatar
    5 years ago

    Hi, StephenGW 

    Try to create 2 measures like below:
    _AuditTime:

    _AuditTime = MAX('Data'[Audit Time])

    Probation:

    Probation =
    VAR _table =
        SUMMARIZE (
            FILTER (
                'Data',
                RANKX ( ALLEXCEPT ( 'Data', Data[Area] ), [_AuditTime],, DESC ) <= 10
                    && [Pass/Fail] = "Fail"
            ),
            [Area]
        )
    RETURN
        IF ( MAX ( 'Data'[Area] ) IN _table, "Yes", "No" )
    

     Note:

           There are some data errors in your sample data. I have corrected the errors when using them.

    Result:

    Please refer to the attachment below for details

     

    Hope this helps.

     

    Best Regards,
    Community Support Team _ Zeon Zheng
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.