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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
khaeshr46
Frequent Visitor

Get rid of filter context by using ALL then bring filter context back

Hi,

I'm looking to only see the total of Chairs in the "Tables" filter context only.

 

I've created a measure that gets rid of the filter conext at sub-category column.

Sales for Chairs 1 ALL at Sub-category level = CALCULATE([Total Sales],
                        'Product ID'[Sub-Category] = "Chairs")
 
I've attemped this to bring the filter conext back in but no go. From my theoretical understanding of DAX, Sales for Chairs 1 ALL at Sub-category level contains ALL('Product ID'[Sub-Category]) which I believe is not letting the KEEPFILTERS work in the 2nd measure.
 
Sales for Chairs in Tables = CALCULATE([Sales for Chairs 1 ALL at Sub-category level],KEEPFILTERS('Product ID'[Sub-Category]="Tables"))
 
Is this possible?
 
Below is my desired output for "Sales of Chairs in Tables". The 2 rows for Bookcases and Chairs should not be there.

 

khaeshr46_1-1698171596097.png

 

 

1 ACCEPTED SOLUTION
EylesIT
Resolver II
Resolver II

@khaeshr46, here is my suggested solution.

 

Create a measure called [Sales for Chairs in Tables]:

 

Sales for Chairs in Tables = 
    SUMX(
        VALUES(YourTable[Subcat]),
        IF(YourTable[Subcat] = "Tables", CALCULATE(SUM(YourTable[sales]), YourTable[Subcat] = "Chairs"))
    )

 

 

This gives me the following results with a subset of your data:

EylesIT_0-1698178650110.png

Hope this helps.

 

View solution in original post

2 REPLIES 2
EylesIT
Resolver II
Resolver II

@khaeshr46, here is my suggested solution.

 

Create a measure called [Sales for Chairs in Tables]:

 

Sales for Chairs in Tables = 
    SUMX(
        VALUES(YourTable[Subcat]),
        IF(YourTable[Subcat] = "Tables", CALCULATE(SUM(YourTable[sales]), YourTable[Subcat] = "Chairs"))
    )

 

 

This gives me the following results with a subset of your data:

EylesIT_0-1698178650110.png

Hope this helps.

 

Did the job! Thanks!!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.