Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Two dimension filters

Hello

 

How can I filter a table in two dimensions?

I.e.:

columns matching {A,B,C}

AND

rows matching COL1="10",COL2="20"

 

Thanks!

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    I created some data:

    dimensions1:

    dimensions2:

    Fact:

    Here are the steps you can follow:

    1. Create measure.

    Flag =
    IF(
        MAX('Fact'[Group]) in {"A","B","C"}&&MAX('Fact'[Col1])=10&&MAX('Fact'[Col2])=20,1,0)
    Sum_Measure =
        SUMX(FILTER(ALLSELECTED(dimensions1),'dimensions1'[Group]=MAX('Fact'[Group])),[Amount1])+
        SUMX(FILTER(ALLSELECTED(dimensions2),'dimensions2'[Col1]=MAX('Fact'[Col1])),[Amoun2])+
        SUMX(FILTER(ALLSELECTED(dimensions2),'dimensions2'[Col2]=MAX('Fact'[Col2])),[Amoun2])

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

     

    If you need pbix, please click here.

    If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

3 Replies

  • Hi Anonymous 

     

    Can you post sample data as text and expected output?
    Not enough information to go on;

    please see this post regarding How to Get Your Question Answered Quickly:
    https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.
    4. Relation between your tables

    Appreciate your Kudos!!
    LinkedIn:www.linkedin.com/in/vahid-dm/

  • croberts21's avatar
    croberts21
    Continued Contributor

    Are you using a Table viz or Matrix viz? This could be important. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    I created some data:

    dimensions1:

    dimensions2:

    Fact:

    Here are the steps you can follow:

    1. Create measure.

    Flag =
    IF(
        MAX('Fact'[Group]) in {"A","B","C"}&&MAX('Fact'[Col1])=10&&MAX('Fact'[Col2])=20,1,0)
    Sum_Measure =
        SUMX(FILTER(ALLSELECTED(dimensions1),'dimensions1'[Group]=MAX('Fact'[Group])),[Amount1])+
        SUMX(FILTER(ALLSELECTED(dimensions2),'dimensions2'[Col1]=MAX('Fact'[Col1])),[Amoun2])+
        SUMX(FILTER(ALLSELECTED(dimensions2),'dimensions2'[Col2]=MAX('Fact'[Col2])),[Amoun2])

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

     

    If you need pbix, please click here.

    If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly