I have a relatively simple problem and haven't gotten a working solution. As the title says I'm trying to create a table with a slicer attached that will give me "True" if the current product is selected or "False" if it is not. This is so I can make a "this or everything else" type of stacked bar chart, and I can't get it to work as expected. Example:
Slicer: |
( ) Product 1 |
( ) Product 2 |
(x) Product 3 |
Product 4 |
Product: | Result: |
Product 1 | false |
Product 2 | false |
Product 3 | true |
Product 4 | false |
And obviously the table(visualization) itself is not affected by the slicer so it will always display all products.
My first approach was using a calculated column like
Solved! Go to Solution.
Hi @Anonymous
You should create the additional table with the list of products (only the one column) and then create a measure:
IsSelected =
VAR __Product = SELECTEDVALUE('Prod'[Column1])
RETURN
IF(__PRODUCT in VALUES('Table'[Product]) , TRUE(), FALSE())
Prod[Column1] - from new table.
_______________
If I helped, please accept the solution and give kudos! 😀
Hi @Anonymous
You should create the additional table with the list of products (only the one column) and then create a measure:
IsSelected =
VAR __Product = SELECTEDVALUE('Prod'[Column1])
RETURN
IF(__PRODUCT in VALUES('Table'[Product]) , TRUE(), FALSE())
Prod[Column1] - from new table.
_______________
If I helped, please accept the solution and give kudos! 😀
@Anonymous See my post here on Power BI order of operations, you will need to use a MEASURE not a COLUMN if you want slicer selection to updat the value: Power BI Order of Operations
Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos. ?
I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.
I tried doing that, but then I was unable to make a true/false calculated column that compares the product in the current row to the value of that Measure.
@Anonymous You cannot do a calculated column, you will need to put the calculated MEASURE in the Values of a Matrix or Table visualization. This can only be done in the report view as a visualization. Slicers cannot update the data model. Try using a measure similar to the one @lkalawski has suggested, though since your Product slicer is not impacting the visual, you may not need the added step of creating a new table. Please share your relationship view with table and column names if you want help specific to your tables.
Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos. ?
I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.
User | Count |
---|---|
411 | |
234 | |
86 | |
65 | |
58 |
User | Count |
---|---|
472 | |
270 | |
137 | |
82 | |
73 |