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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
DW868990
Helper IV
Helper IV

Value to show when item selected within more than 1 item

Hi,

 

I have a card visual that shows a message when certain products are selected by the end user in a slicer.

 

So for example they select "Product1" and the message will pop up in a card visual which is great, I used SELECTEDVALUE to do this.

 

But my issue is if "Product1" is selected along with other products I still require the message to pop up in the card as "Product1" is part of the selection the end user has chosen.

 

Struggling to get the DAX correct for this capability, thanks in advance.

 

JJ

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

 

// Measure that returns True if "Product1" has been
// selected in the slicer. Does not matter if just
// this one product or as part of the selection.

[Product1 Selected?] =
var ProductOfInterest = "Product1"
var ProductsSelected = values( Slicer[Product] )
var Output = ProductOfInterest in ProductsSelected
return
    Output

 

or...

 

[# ProductsOfInterest] =
// ProductsOfInterest could be harvested from a
// table instead of hard-coded.
var ProductsOfInterest = 
    {
        "Product1",
        "Product2",
        "Product3"
    }
var ProductsSelected = values( Slicer[Product] )
// Output = the number of products of interest
// that are present in the current slicer
// selection.
var Output = 
    countrows(
        intersect(
            ProductsOfInterest,
            ProductsSelected
        )
    )
return
    Output

or...

[ProductsOfInterest] =
// ProductsOfInterest could be harvested from a
// table instead of hard-coded.
var ProductsOfInterest = 
    {
        "Product1",
        "Product2",
        "Product3"
    }
var ProductsSelected = values( Slicer[Product] )
// Output = the names of products of interest
// that are present in the current slicer
// selection.
var Output = 
    concatenatex(
        intersect(
            ProductsSelected,
            ProductsOfInterest
        ),
        Slicer[Product],
        ", ",
        Slicer[Product],
        ASC
    )
return
    Output

 

 

 

View solution in original post

3 REPLIES 3
daXtreme
Solution Sage
Solution Sage

 

// Measure that returns True if "Product1" has been
// selected in the slicer. Does not matter if just
// this one product or as part of the selection.

[Product1 Selected?] =
var ProductOfInterest = "Product1"
var ProductsSelected = values( Slicer[Product] )
var Output = ProductOfInterest in ProductsSelected
return
    Output

 

or...

 

[# ProductsOfInterest] =
// ProductsOfInterest could be harvested from a
// table instead of hard-coded.
var ProductsOfInterest = 
    {
        "Product1",
        "Product2",
        "Product3"
    }
var ProductsSelected = values( Slicer[Product] )
// Output = the number of products of interest
// that are present in the current slicer
// selection.
var Output = 
    countrows(
        intersect(
            ProductsOfInterest,
            ProductsSelected
        )
    )
return
    Output

or...

[ProductsOfInterest] =
// ProductsOfInterest could be harvested from a
// table instead of hard-coded.
var ProductsOfInterest = 
    {
        "Product1",
        "Product2",
        "Product3"
    }
var ProductsSelected = values( Slicer[Product] )
// Output = the names of products of interest
// that are present in the current slicer
// selection.
var Output = 
    concatenatex(
        intersect(
            ProductsSelected,
            ProductsOfInterest
        ),
        Slicer[Product],
        ", ",
        Slicer[Product],
        ASC
    )
return
    Output

 

 

 

Thanks for this but i now need to return a specific number or message based on the output.

So if output is product1 = 1

output is product 1 and product 2 = 2
output is product1, product2 and product3 = 3

and so on etc

And what if the output is "product1 and product3"? What then would you like to return? The above requirement of yours is rather simple to satisfy and code around. Use SWITCH and one of my previous measures.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.