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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
veerub
Frequent Visitor

Card to show Top N as a percentage of total

Hi All,

 

I need some assistance on getting the Top 3 as a percentage of total.

I have a dataset with three column Name, Category and Revenue.

I would like to have the following

1. a card which shows me the top 3 customer for clothing as a percentage of Total Clothing. From the sample, the expected result is 90%

2. a card which shows me the top 3 customer for clothing as a percentage of Total. From the sample, the expected result is 50.9%

 

veerub_0-1625822603574.png

 

Thanks

VB

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@veerub 

Please refer to my example pbix, I put the 2 variables into 2 measures just to show clarify the calculation.

 

measure_ =
var top3 =SUMX(TOPN(3,FILTER(ALLSELECTED('Table'),[Category]=MAX([Category])),[Revenue],DESC),[Revenue])
var sum_ = SUMX(FILTER(ALLSELECTED('Table'),'Table'[Category]=MAX([Category])),[Revenue])
Return top3/sum_
Vpazhenmsft_1-1626075606674.png

 

 

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

 

View solution in original post

3 REPLIES 3
V-pazhen-msft
Community Support
Community Support

@veerub

Add another expression to calculate by the sub category.

FILTER(ALLSELECTED('Table'),[Category]=MAX([Category])&& [clothing sub cate]=max([clothing sub cate]))

 

 

Paul

V-pazhen-msft
Community Support
Community Support

@veerub 

Please refer to my example pbix, I put the 2 variables into 2 measures just to show clarify the calculation.

 

measure_ =
var top3 =SUMX(TOPN(3,FILTER(ALLSELECTED('Table'),[Category]=MAX([Category])),[Revenue],DESC),[Revenue])
var sum_ = SUMX(FILTER(ALLSELECTED('Table'),'Table'[Category]=MAX([Category])),[Revenue])
Return top3/sum_
Vpazhenmsft_1-1626075606674.png

 

 

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

 

@V-pazhen-msft  , Thanks a lot for solution. I made some minor changes  as per below

top3A =
SUMX(
TOPN(3,
FILTER(ALLSELECTED('Table'),'Table'[Category]= "Clothing"),
[Revenue],
DESC),
 
But I still have a challenge. I realised that clothing had a sub category another column (type). How do i summarise clothing by type, so that the Top 3 clothing give me the top 3 clothing by type?
'Table'[Revenue])
 
 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors