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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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