Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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
Solved! Go to Solution.
// 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
// 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.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |