Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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
Solved! Go to Solution.
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:
@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]))
Thanks.
But this is not the answer to my question.
I don't want to calculate SUM.
I want to filter the table visual.
@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
Thanks.
But I'm getting errors:
Mind you that column "Value" is a string column (not numeric). Sorry, but I don't understand what you are summing.
Thanks.
@Anonymous , can you share complete formula you created
My pbix file is very large with many columns and with different column names.
Can you please share the file you created the measures in?
Much appreciated.
@Anonymous , Please find the attached file after the signature.
Thanks a lot.
I checked the file. It works well when data "Value" is of type numeric. My data is actually of type String. ( I should have provided a better working example in my post)
Could you please provide a solution for such type of data?
Many thanks
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:
User | Count |
---|---|
98 | |
91 | |
84 | |
72 | |
67 |
User | Count |
---|---|
114 | |
103 | |
100 | |
72 | |
64 |