Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Folks,
I have a requirement where i need to calcualte the Average of subcategory sales values but there is another condition where i need to pick only those subcategories which have maximum sales in each category.
Here is the sample dataset where i have category column and subcategory column and sales. Now i want to pick one subcatgory from each catgory and respective sales for that subcategory and then do the average of it.
Desired result would be 98 in KPI Card. it will be something summarize over summarize because my subcategories value can also repeat. So first we need to aggregate category and subcategory sales and then take maximum for each subcategory and then derive averaga. Any opinion would be helpful
Cat | Sub | Sales |
C1 | S1 | 27 |
C1 | S2 | 8 |
C1 | S3 | 15 |
C1 | S4 | 85 |
C1 | S4 | 90 |
C2 | S5 | 64 |
C2 | S6 | 28 |
C2 | S7 | 12 |
C2 | S8 | 56 |
C3 | S9 | 48 |
C3 | S10 | 11 |
C3 | S10 | 44 |
Solved! Go to Solution.
Hi @sumitsingla12 - create a below measure, that will first aggregate the sales by subcategory within each category. you can replace with your tablename.
Proud to be a Super User! | |
@rajendraongole1 Thank you so much . it seems to be working fine.
Can i ask u one more favour. In this one we are doing average of same measure.
What if i have another measure lets say profit and i want to calcualte the sum of profit for those subcategory with maximum sales within a category.
@rajendraongole1 Thank you so much . it seems to be working fine.
Can i ask u one more favour. In this one we are doing average of same measure.
What if i have another measure lets say profit and i want to calcualte the sum of profit for those subcategory with maximum sales within a category.
Hi @sumitsingla12 - create a below measure, that will first aggregate the sales by subcategory within each category. you can replace with your tablename.
Proud to be a Super User! | |
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
71 | |
37 | |
30 | |
28 |
User | Count |
---|---|
91 | |
49 | |
45 | |
38 | |
36 |