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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Card value is blank when multiple selections in a slicer

 
Hello!

I'm wondering if it's possible to add a condition and how would it look like that if multiple selections were made to a slicer it shows a blank for this card?

EURO-Emission classification =
SWITCH (
TRUE();
vehiclesettings_BI_LL[Year] < 1992; "No Year";
vehiclesettings_BI_LL[Year] <= 1997 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 1";
vehiclesettings_BI_LL[Year] <= 1998 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 2";
vehiclesettings_BI_LL[Year] <= 2000 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 3";
vehiclesettings_BI_LL[Year] <= 2005 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 4";
vehiclesettings_BI_LL[Year] <= 2008 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 5";
vehiclesettings_BI_LL[Year] <= 2013 && vehiclesettings_BI_LL[MonthNumber] <= 12; "Euro 5";
"Euro 6")
4 REPLIES 4
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous -

 

Use HASONEVALUE( )

 

IF ( HASONEVALUE ( vehiclesettings_BI_LL[Year] ),

    SWITCH(

     .... ,

    "Euro 6"),

"")   //ELSE

 

Note, this will also show "" if 0 slicer selections are made.

 

Hope this helps

David

Anonymous
Not applicable

I tried using this syntax but it changed all of my Euro values inside the column to Blank and the card also shows Blank as the answer if only one vehicle was selected. Could the problem be that this is a calculated column instead of a measure?

EURO-Emission classification =
IF(HASONEVALUE(vehiclesettings_BI_LL[Year]);

SWITCH (
TRUE();
vehiclesettings_BI_LL[Year] < 1992; "No Year";
vehiclesettings_BI_LL[Year] <= 1997 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 1";
vehiclesettings_BI_LL[Year] <= 1998 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 2";
vehiclesettings_BI_LL[Year] <= 2000 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 3";
vehiclesettings_BI_LL[Year] <= 2005 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 4";
vehiclesettings_BI_LL[Year] <= 2008 && vehiclesettings_BI_LL[MonthNumber] <= 10; "Euro 5";
vehiclesettings_BI_LL[Year] <= 2013 && vehiclesettings_BI_LL[MonthNumber] <= 12; "Euro 5";
vehiclesettings_BI_LL[Year] <= 2014; "Euro 6");
"Blank")

@Anonymous - if you want any value to change with a slicer, it must be a measure. Calculated columns are only refreshed once when the entire dataset is refreshed.

 

If you're still having trouble, please share a copy of your PBIX file with sensitive data scrubbed out.

 

David

Anonymous
Not applicable

I changed my syntax to work in a measure and now it works as intended. Thank you for your help!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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