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
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])
)

@ 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])
)

@ 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors