Forum Discussion

SK87's avatar
SK87
Helper III
4 years ago
Solved

Need to create a Matrix table

Hi tamerj1 , SpartaBI  I have one more problem not getting the desired o/p:   I have dataset with two columns and need to create a table with Top 3 values then percentage of counts of respective v...
  • luohen's avatar
    4 years ago

    Hi  SK87 ,

    I created a sample pbix file(get it from this link) for you, please check whether that is what you want. You can create measures as below to get it:

    1. Create a measure as below to get the count of B

    CountB = 
    CALCULATE (
        COUNT ( 'Data'[B] ),
        FILTER (
            'Data',
            'Data'[B] = SELECTEDVALUE ( 'Data'[B] )
                && NOT ( ISBLANK ( 'Data'[B] ) )
        )
    )

    2. Create a measure as below to get the rank for B

    RankB = RANKX ( ALLSELECTED ( 'Data'[B] ), [CountB],, DESC, DENSE )

    3. Create a measure as below to get the percentage for B

    PercentageB = 
    VAR _allcount =
        CALCULATE (
            COUNT ( 'Data'[B] ),
            FILTER ( ALLSELECTED ( Data ), NOT ( ISBLANK ( 'Data'[B] ) ) )
        )
    RETURN
        DIVIDE ( [CountB], _allcount, 0 )

    4. Create a matrix visal and apply a visual-level filter with the condition ([RankB] is less than or equal to 3)

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards