Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
SK87
Helper III
Helper III

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 values abd then need to calculate same with last 6 months.

Sample dataset

Date B C
2022-05-18 8 W
2022-05-05 8 W
2022-04-05 8 W
2022-04-05 8 W
2022-01-05 8 W
2022-01-01 10 W
2022-01-24 8 BL
2022-01-10 8 BL
2022-01-01 8 BL
2022-03-27 6 W
2022-02-05 8 W
2022-01-26 8 W
2022-01-27 8 GR
2022-01-11 8 W
2022-05-03 8 W
2022-02-03 8 W
2022-04-18 6 W
2022-03-31 8 W
2022-05-16 8 W
2022-02-08 8 W
2022-01-06 6 R
2022-02-07   W

O/P - 

Top 3BBBCCC
Type8610WBLGR
Percentage      
Percentage L6Months      


I have created a calculated column of different columns in seperate table

For Column B - 

B = DISTINCT(
    FILTER(
        VALUES(Data[B]),
        Data[B] <> "Null"))

%  = ('B'[Count of B]/SUM('B'[Count of B])*100)
 
Rank_name B =
Var A = RANKX('B', 'B'[Count of B])
RETURN A
 
But when I place the same columns in Table I am not getting desired o/p.
1 ACCEPTED SOLUTION
luohen
Resolver II
Resolver II

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)

luohen_0-1660205903099.png

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

View solution in original post

2 REPLIES 2
luohen
Resolver II
Resolver II

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)

luohen_0-1660205903099.png

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

SK87
Helper III
Helper III

@amitchandak 

@tamerj1 

 

Any updates on above problem.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.