Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Filter Multiple Tables

Hi All,

Assume a table as follows.

Table 1
Table 1

Table 2
Table 2

 

 

 

 

 

 

 

 

 

 

 

I need output considering following steps:

 

1) Select ID from Table 2 where R1=MAX(R1)

2) Output will be 1,2 and 8 ,  as MAX of R1=10

//Please ignore 12 .

3) From O/P of Step 2 I need to select by Max R2.
Thus result shall be  ID=2.

4) Select Corresponding Final Title from Table 1 for ID=2

Help is appriciated.


Regards

Ayush

 
 

9 Replies

  • Try like

    measure =
    var _max =maxx(Table2,Table2[R1])
    return
    calculate(countrows(Table2),filter(Table2,Table2[R1] =_max))

     

    measure =
    var _max =maxx(Table2,Table2[R2])
    return
    calculate(countrows(Table2),filter(Table2,Table2[R2] =_max))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi amitchandak 

      The mentioned measure would return me the Count of Rows .

      I need to get the exact ID from Table 2 which has highest combination i.e. R1=10 and R2=10.
      The measure for CountRow returns the no of rows.

       

      Regards

      Ayush

  • v-diye-msft's avatar
    v-diye-msft
    Community Support

    Hi Anonymous 

     

    1) Select ID from Table 2 where R1=MAX(R1)

    2) Output will be 1,2 and 8 ,  as MAX of R1=10

    It's incorrect, coz MAX of R1=12 in your table.  I changed the 12 as 9 as your logic.

    Then kindly find my results below:

    Pbix attached.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

      That did help me but if there is a case as follows the Measure 3 throws Blank.

       

       

       

       

       

       

       

       

       

       

      I have edited R2 and inserted 20, it should still give me output as ID=2 , but instead shows blank.
      v-diye-msft 

      • v-diye-msft's avatar
        v-diye-msft
        Community Support

        Hi Anonymous 

         

        When you insert 20, the ID= 9 of MAX(R2), based on your previous description:

         

        3) From O/P of Step 2 I need to select by Max R2.

        From the ID results of MAX(R1), which is 1,2,8,  9 is definitely out of the range. that's why it's blank.