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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.