Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello
I have a table visual:
A, 1
A, 2
B, 1
etc
I want to create a filter visual (slicer) with the entries:
Category A
Category B
When I select the entry Category A, I want to filter the table for Col1 = A and Col2 = 1.
When I select the entry Category B, I want to filter the table for Col2 = B and Col2 =1.
Can you tell me please how to achieve this?
Do I need to create a measure first and add it as a slicer visual?
What would be the code of the measure?
Or is there another way?
Thanks!
Hi @UsePowerBI,
First create a slicer table containing all the categories;
Then create 2 measures as below:
_column1 = CALCULATE(MAX('Table'[Column1]),FILTER('Table','Table'[Column1]=RIGHT(SELECTEDVALUE(Slicer[Column1]),1)))
_column2 = CALCULATE(MAX('Table'[Column2]),FILTER('Table','Table'[Column1]=RIGHT(SELECTEDVALUE('Slicer'[Column1]),1)&&'Table'[Column2]=1))
And you will see:
For the related .pbix file,pls click here.
@Anonymous
Thanks but I am not sure how to do the 'First create a slicer table containing all the categories;'
Can you elaborate please?
@UsePowerBI , Try like
Measure =
Var _1 = if(selectedvalue(Table[slicer])="Category A",filter(Table,Table[Col1] = "A" && Table[Col2] = 1),filter(Table,Table[Col1] = "B" && Table[Col2] = 1))
return
calculate([measure],_1)
Thanks but what is Table[slicer]? Is it another MEASURE?
@UsePowerBI , You need to have a table with values
Assume : TableSlicer
Slicer |
Category A |
Category B |
Measure =
Var _1 = if(selectedvalue(TableSlicer[slicer])="Category A",filter(Table,Table[Col1] = "A" && Table[Col2] = 1),filter(Table,Table[Col1] = "B" && Table[Col2] = 1))
return
calculate([measure],_1)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |