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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
PBI12345
Frequent Visitor

Help with SELECTEDVALUE: How to exclude from my filter condition if more than one value selected?

Hi,


In the below DAX, I am creating a measure with multiple filters. The last filter condition (bolded) is causing me issues.

 

AsAt Leisure Revenue LY =
CALCULATE(
    SUM(
        'Data: RADAR'[Revenue Held (LY)]),
            ALL('Booking Agents'),
            'Data: RADAR'[Source] = "AsAt",
            'Booking Agents'[Psuedo Segment Type] = "Leisure",
            'Network Group Table'[Network Group] = SELECTEDVALUE('Data: RADAR'[Network Group])

)

 

When only a single value for "Network Group" is selected in a slicer, the DAX works as intended. However, if muliple or no selections are made for "Network Group", the entire calculation returns "(Blank)".

If there are mutliple or no "Network Group" values selected, I instead want the entire final filter condition to be ignored, and have no filtering based on the selected value of "Network Group". 

 

I have tried using combinations of the IF, HASONEVALUE and also returning BLANK() as the alternate result, but nothing is working out.

 

A huge thanks in advance to anybody that can assist! 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@PBI12345 Try this:

AsAt Leisure Revenue LY =
CALCULATE(
    SUM(
        'Data: RADAR'[Revenue Held (LY)]),
            ALL('Booking Agents'),
            'Data: RADAR'[Source] = "AsAt",
            'Booking Agents'[Psuedo Segment Type] = "Leisure",
            'Network Group Table'[Network Group] IN DISTINCT('Data: RADAR'[Network Group])
)

Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@PBI12345 Try this:

AsAt Leisure Revenue LY =
CALCULATE(
    SUM(
        'Data: RADAR'[Revenue Held (LY)]),
            ALL('Booking Agents'),
            'Data: RADAR'[Source] = "AsAt",
            'Booking Agents'[Psuedo Segment Type] = "Leisure",
            'Network Group Table'[Network Group] IN DISTINCT('Data: RADAR'[Network Group])
)

Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler worked perfectly! can't thank you enough for your help

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.