The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I read a seperate post on a similar topic, and I am not sure whether this is possible, but I would like to have columns in a table that are linked to a slicer selection.
I have mapped out the scenario below:
Slicer Selection 1: One Value from; Country, Continent, Product, Category
Slicer Selection 2: One Value from; Country, Continent, Product, Category
Table A - Slicer Column 1: SWITCH,
Country, Table A [Country]
Continent, Table A [Continent]
Product, Table A [Product]
Category, Table A [Category]
All of the values I would like to switch between are contained in the same table (Table A), but with the addition of these columns, I can add this field into Rows and it would allow for dynamic selection.
Hopefully the scenario is fairly clear, and I am happy to hear different workarounds.
Solved! Go to Solution.
Hi, @Anonymous
According to your description, I can roughly understand your requirement, I think you can only use measures to achieve this because calculated columns can’t be affected by the slicer and the measure can’t be changed based on the selections of slicer, you can try my steps:
Selected column1 =
var _selectedvalue=SELECTCOLUMNS('Slicer',"1",[Name])
return
SWITCH(
TRUE(),
"Country" in _selectedvalue,MAX('Table'[Country]),
"Continent" in _selectedvalue,MAX('Table'[Continent]),
"Product" in _selectedvalue,MAX('Table'[Product]),
"Category" in _selectedvalue,MAX('Table'[Catrgory]),
BLANK())
Selected column2 =
var _selectedvalue=SELECTCOLUMNS('Slicer',"1",[Name])
return
SWITCH(
TRUE(),
"Category" in _selectedvalue,MAX('Table'[Catrgory]),
"Product" in _selectedvalue,MAX('Table'[Product]),
"Continent" in _selectedvalue,MAX('Table'[Continent]),
"Country" in _selectedvalue,MAX('Table'[Country]),
BLANK())
And you can get what you want.
You can download my test pbix file below
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
According to your sample picture, I can roughly understand your problem, I think the true reason for your problem is that you didn’t place another column to distinguish the identical rows in these two columns, I think you can try to place the [Sales] column into the table chart and set as “Don’t summarize” to make it work:
This is my modified test data:
I set the table chart like this:
And you can get what you want.
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
According to your sample picture, I can roughly understand your problem, I think the true reason for your problem is that you didn’t place another column to distinguish the identical rows in these two columns, I think you can try to place the [Sales] column into the table chart and set as “Don’t summarize” to make it work:
This is my modified test data:
I set the table chart like this:
And you can get what you want.
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
According to your description, I can roughly understand your requirement, I think you can only use measures to achieve this because calculated columns can’t be affected by the slicer and the measure can’t be changed based on the selections of slicer, you can try my steps:
Selected column1 =
var _selectedvalue=SELECTCOLUMNS('Slicer',"1",[Name])
return
SWITCH(
TRUE(),
"Country" in _selectedvalue,MAX('Table'[Country]),
"Continent" in _selectedvalue,MAX('Table'[Continent]),
"Product" in _selectedvalue,MAX('Table'[Product]),
"Category" in _selectedvalue,MAX('Table'[Catrgory]),
BLANK())
Selected column2 =
var _selectedvalue=SELECTCOLUMNS('Slicer',"1",[Name])
return
SWITCH(
TRUE(),
"Category" in _selectedvalue,MAX('Table'[Catrgory]),
"Product" in _selectedvalue,MAX('Table'[Product]),
"Continent" in _selectedvalue,MAX('Table'[Continent]),
"Country" in _selectedvalue,MAX('Table'[Country]),
BLANK())
And you can get what you want.
You can download my test pbix file below
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-robertq-msft This is really close to being perfect.
When I apply the logic in the file the only issue is that my data has repeated values in the main table as per the below screenshot
When I then put this into the Matrix I get a table which looks like the below pivot table. If I remove the ID column, then I get single line which only shows the last value for the column (due to the MAX() formula).
Is there any way to work around this?
@Anonymous , if you are planning to create a calculated column in the table using the slicer value, that is not possible. You have think in term of measures