Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I hope you're doing well.
I have a question regarding slicer in Power Bi. Example: I'm working with a table named "cars" that contains the following columns: Make, model. year and mielage.
I would like to set up a slicer where the options are the column names themselves-for example, "make" and "model"-instead of values within those columns. When a user selects one or more of these column names in the slicer, the visual below should display all the records where the selected column(s) contain the string value "missing".
Is there a way to achieve this setup in power BI? Any guidance or workaround would be greatly appreciated.
Solved! Go to Solution.
Hi @prad001 ,
As per your post description, I used DAX expression to handle the scenario.
Please find the attached pbix file for your reference.
Using Column Names as Slicer Option.pbix
Please let me know if you have further questions.
If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks!
Best Regards,
Maruthi
Hi @prad001 ,
Thank you for engaging with the Microsoft Fabric Community.
Many thanks to @maruthisp and @Shravan133 for their prompt and helpful responses to this query.
I’ve reviewed and tested the .pbix file shared by @maruthisp , and I can confirm that the provided solutions are accurate and meet the requirements outlined in your query. Please take a moment to review the responses, and feel free to share any feedback or let us know if you need further assistance.
If the replies have resolved your issue, kindly consider marking the appropriate response as the Accepted Solution and giving kudos to help others with similar questions.
Thank you.
Hi @prad001 ,
As per your post description, I used DAX expression to handle the scenario.
Please find the attached pbix file for your reference.
Using Column Names as Slicer Option.pbix
Please let me know if you have further questions.
If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks!
Best Regards,
Maruthi
Hi @prad001 ,
As per your post description, I used DAX expression to handle the scenario.
Please find the attached pbix file for your reference.
Using Column Names as Slicer Option.pbix
Please let me know if you have further questions.
If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks!
Best Regards,
Maruthi
Create a Disconnected Table for Column Selection
In Power BI, go to Modeling > New Table and create this:
MissingColumns =
DATATABLE(
"ColumnName", STRING,
{
{ "Make" },
{ "Model" },
{ "Year" },
{ "Mileage" }
}
)
This will be the source for your slicer.
Create a DAX Measure to Check If a Row Has "Missing" in a Selected Column
Add this measure to your model:
ShowRow =
VAR SelectedColumns = VALUES(MissingColumns[ColumnName])
VAR IsMakeMissing = "Make" IN SelectedColumns && SELECTEDVALUE(Cars[Make]) = "missing"
VAR IsModelMissing = "Model" IN SelectedColumns && SELECTEDVALUE(Cars[Model]) = "missing"
VAR IsYearMissing = "Year" IN SelectedColumns && SELECTEDVALUE(Cars[Year]) = "missing"
VAR IsMileageMissing = "Mileage" IN SelectedColumns && SELECTEDVALUE(Cars[Mileage]) = "missing"
RETURN
IF(IsMakeMissing || IsModelMissing || IsYearMissing || IsMileageMissing, 1, 0)
Now add a table visual to show your Cars data.
Then:
Now You Can:
User | Count |
---|---|
84 | |
79 | |
71 | |
48 | |
43 |
User | Count |
---|---|
111 | |
54 | |
50 | |
40 | |
40 |