Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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:

 

NoPackageValue
1A12
2A13
3B20
4C15
5All Packages10
6All Packages5
7All Packages0
8B8

 

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:

NoPackage
1A
2B
3C

 

How can I achieve this task? 

Please help

  • Anonymous's avatar
    Anonymous
    5 years ago

    amitchandak 

    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

  • 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]))

    • Anonymous's avatar
      Anonymous
      Not 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.

      • amitchandak's avatar
        amitchandak
        Super 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