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
Carly_717
Frequent Visitor

Get the value for sub category by certain %

Hi all,

I would like to get the total sales of subcategory where the main category is more than certain %

Carly_717_1-1749111034388.png

 

I would like to show all the sales of sub category where the total weightage is more or equal to 30%. 
for example, the main category that is more than 30% are "Clothes 2" and "Car"
and now, I want to get all details of item in sub category which are under "Clothes 2" and "Car".

Carly_717_0-1749111022587.png

 

How can I solve this by creating the measure in power bi ? 


Thanks in advance.

 

1 ACCEPTED SOLUTION
SamsonTruong
Super User
Super User

Hi @Carly_717 ,

One approach to this is by creating a filter flag measure. To create the measure, try using the following DAX:

FilterFlag =
VAR TotalSales = CALCULATE(SUM(SalesData[Sales]), ALL(SalesData))
VAR MainCategorySales =
    CALCULATE(
        SUM(SalesData[Sales]),
        ALLEXCEPT(SalesData, SalesData[MainCategory])
    )
VAR Weightage = DIVIDE(MainCategorySales, TotalSales)
RETURN
IF(Weightage >= 0.3, 1, 0)


Then add this measure to your filter pane and set it to where the FilterFlag is equal to 1.

SamsonTruong_0-1749112337743.png

 

This will filter your visual to all sales of sub category where the total weightage is more or equal to 30%. 

If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.

Thanks,

Samson

 

 

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

If you already have measures for [Sales] and [Weightage] you can create a new measure like

Sales for category above 30 =
VAR MainCategories =
    FILTER ( ALL ( 'Table'[Main Category] ), [Weightage] >= 0.3 )
VAR Result =
    CALCULATE ( [Sales], KEEPFILTERS ( MainCategories ) )
RETURN
    Result
SamsonTruong
Super User
Super User

Hi @Carly_717 ,

One approach to this is by creating a filter flag measure. To create the measure, try using the following DAX:

FilterFlag =
VAR TotalSales = CALCULATE(SUM(SalesData[Sales]), ALL(SalesData))
VAR MainCategorySales =
    CALCULATE(
        SUM(SalesData[Sales]),
        ALLEXCEPT(SalesData, SalesData[MainCategory])
    )
VAR Weightage = DIVIDE(MainCategorySales, TotalSales)
RETURN
IF(Weightage >= 0.3, 1, 0)


Then add this measure to your filter pane and set it to where the FilterFlag is equal to 1.

SamsonTruong_0-1749112337743.png

 

This will filter your visual to all sales of sub category where the total weightage is more or equal to 30%. 

If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.

Thanks,

Samson

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.