Forum Discussion
Using Column Names as Slicer Option
- 1 year ago
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)
- Apply a Visual-Level Filter on the Table Visual
Now add a table visual to show your Cars data.
Then:
- Drag the ShowRow measure into the visual’s Filters pane
- Set filter to ShowRow = 1
Now You Can:
- Use a slicer on MissingColumns[ColumnName]
- Select one or more column names (like "Model" and "Mileage")
- The table will dynamically show rows where either column has the value "missing"