Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I've been trying to create a slicer so I can filter my data based on values in two columns.
Here's a sample of the data I have in my table:
| Dog Owner | Cat Owner |
| yes | no |
| yes | no |
| yes | yes |
| no | no |
| no | yes |
| no | yes |
| no | no |
| no | no |
| no | no |
| yes | no |
| yes | no |
| no | yes |
| yes | no |
| yes | no |
| no | yes |
| no | no |
| no | no |
I'd like to create a slicer so that I can filter this data based on these choices which relate to specific conditions:
I originally tried to create a column, but learned I can't create a column that uses a switch off of a dynamic value. Is there another way to do it?
| Slicer ID | Slicer values | Filter conditions |
| 1 | Dog owner, include cat owners | [Dog Owner] = "yes" |
| 2 | Cat Owners Only | [Cat Owner]="yes" and [Dog Owner]<>"yes" |
| 3 | Dog and cat owners | [Cat Owner]="yes" and [Dog Owner]="yes" |
| 4 | All |
Solved! Go to Solution.
Hi, @RolandPlanet
Maybe you can create a calculated column and try the following dax:
Slicer Category =
SWITCH(
TRUE(),
[Dog Owner] = "yes" && [Cat Owner] = "yes", "Dog and cat owners",
[Dog Owner] = "yes", "Dog owner, include cat owners",
[Cat Owner] = "yes", "Cat Owners Only",
"All"
)
Then create a new table:
Table 2 = SUMMARIZE('Table','Table'[Slicer Category],"Index",RANKX(ALLSELECTED('Table'),'Table'[Slicer Category],,DESC,Dense))
Here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @RolandPlanet
Maybe you can create a calculated column and try the following dax:
Slicer Category =
SWITCH(
TRUE(),
[Dog Owner] = "yes" && [Cat Owner] = "yes", "Dog and cat owners",
[Dog Owner] = "yes", "Dog owner, include cat owners",
[Cat Owner] = "yes", "Cat Owners Only",
"All"
)
Then create a new table:
Table 2 = SUMMARIZE('Table','Table'[Slicer Category],"Index",RANKX(ALLSELECTED('Table'),'Table'[Slicer Category],,DESC,Dense))
Here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
To clarify, does Slicer ID correspond to Dog Owner does not equal no? All other values are accepted?
Sorry for the confusion - I created a table called 'Slicer Table' and had an 'ID' column and 'Value' column.
I added the 'ID' column because I was trying to create a calculated column to set a value based on SELECTED('Slicer Table'[ID]) and the value in each row for 'Dog Owner' and 'Cat Owner'.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 32 | |
| 27 | |
| 25 |