Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as 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 C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
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.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as 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 C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@lkalawski @AllisonKennedy Is there any other way to use column instead of measure? I want to use column to filter my visual based on it. The reason for doing this, I want to filter my visual on true only. So that if no value was selected, the visual will give blank value.
@Maha1 did you figure this out? If not, please start a new post and link to this one and @ mention me (sorry for the delay reply in this thread). There is no way a column will update based on slicer selection, so it must be a measure, but you can add that measure to the visual and add a visual level filter for [measure] = 'true' so that only the true values are displayed as the slicer changes. Hope that helps clarify?
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as 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 C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
75 | |
62 | |
51 | |
47 |
User | Count |
---|---|
212 | |
82 | |
61 | |
60 | |
57 |