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
vega
Resolver III
Resolver III

Using ALL But Keeping Explicit Filters

Hello all,

 

I am looking to create a measure that uses the ALL DAX function, but also takes into account filters that the user may explicitly filter out. Here is a quick example that I created for testing purposes:

ColorAmount

Red1
Blue2
Black3
Red4
Blue5
Black6
Orange7
Yellow8
Green9

 

Using the above data I created a measure that uses the ALL function and sums the colors that do not begin with B:

 

Sum of Non B Colors = 
CALCULATE(
    SUM(Table1[Amount]),
    ALL(Table1),
    LEFT(Table1[Color],1) <> "B"
)

 

This produced the following results:

 

Capture

 

Now when I deselect Yellow, I still see the same results, this is because of the ALL function. I would like the measure to display 21 when Yellow is deselected. How can I accomplish this?

 

Thank you!

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@vega

 

Hi, try with this:

 

SumNonBColor =
CALCULATE (
    SUM ( Table1[Amount] ),
    FILTER ( ALLSELECTED ( Table1[Color] ), LEFT ( Table1[Color] ) <> "B" )
)

Regards

 

Victor




Lima - Peru

View solution in original post

2 REPLIES 2
Vvelarde
Community Champion
Community Champion

@vega

 

Hi, try with this:

 

SumNonBColor =
CALCULATE (
    SUM ( Table1[Amount] ),
    FILTER ( ALLSELECTED ( Table1[Color] ), LEFT ( Table1[Color] ) <> "B" )
)

Regards

 

Victor




Lima - Peru

This is perfect,

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.