Forum Discussion

char23's avatar
char23
Icon for Helper II rankHelper II
2 years ago
Solved

Count rows based on slicer selection is showing blank

I am trying to write a measure. I have the following table. I want the user to be able to select a month. If the user selects June. Then I want previous month = 2 which is May. 1 plus the date rank g...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi char23 ,

     

    You can try to disconnect the relationship between Table1 and Table 2:

    then use this measure:

    MEASURE = 
    VAR __selected_month_rank =
        SELECTEDVALUE ( 'Table2'[Date Rank] )
    VAR __result =
        IF (
            ISBLANK ( __selected_month_rank ),
            BLANK (),
            IF ( 
                SELECTEDVALUE( 'Table1'[Date Rank] )
                    IN { __selected_month_rank, __selected_month_rank + 1 },
                CALCULATE (
                    COUNTROWS ( 'Table1' ),
                    'Table1'[Status] = "Not Normal"
                        && 'Table1'[Previous Status] = "Not Normal"
                        && 'Table1'[Type] = "Task"
                )
            )
        )
    RETURN
        __result

    Output:

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum