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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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