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
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
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.