Forum Discussion
Filter table visual by a slicer
Hi,
I have this table visual, and I want to filter it based on the selected value in the slicer (a package slicer).
Example of the table and the table visual is:
| No | Package | Value |
| 1 | A | 12 |
| 2 | A | 13 |
| 3 | B | 20 |
| 4 | C | 15 |
| 5 | All Packages | 10 |
| 6 | All Packages | 5 |
| 7 | All Packages | 0 |
| 8 | B | 8 |
More precisely what I want is:
* I can only have Package A, B, and C in the slicer. That is, package list has come from another data table related to this data table.
* When Package A, B, or C is not selected, rows related to "All Packages" should be shown.
* When any Package A, B, or C is selected, rows related to that package should only be shown (and not "All Packages" at all!).
This is the package table I should have:
| No | Package |
| 1 | A |
| 2 | B |
| 3 | C |
How can I achieve this task?
Please help
- Anonymous5 years ago
Your equation in the file was really really helpful.
I finally managed to solve the problem using COUNT on "No." column instead of SUM.
Then used the measure in the filter section, and limited it to equal 1 only.
So, final equation:
Measure2 =IF(ISFILTERED(package[package]), CALCULATE(COUNT('Fact'[No]), FILTER('Fact', 'Fact'[Package] IN VALUES(Package[Package]))), CALCULATE(COUNT('Fact'[No]), FILTER('Fact', 'Fact'[Package] in ROW("Package","All Packages"))))
9 Replies
- amitchandakSuper User
Anonymous , if the tables are disconnected, best option in this case
measure =
var _max = if(isfiltered(package[package]), values(package[package]), ROW("package","All Packages"))
return
calculate(sum(Table[Value]),filter(Table, Table[package] in _max))if those are connected
measure =
var _max = if(isfiltered(package[package]), values(package[package]), ROW("package","All Packages"))
return
calculate(sum(Table[Value]),filter(package, package[package] in _max), removefilters(package[package]))- AnonymousNot applicable
Thanks.
But this is not the answer to my question.
I don't want to calculate SUM.
I want to filter the table visual.
- amitchandakSuper User
Anonymous , Measure has a filter, so if this is the only measure, the visual table will filter. Or all the measures need to follow this type of code