Forum Discussion

Tlotly's avatar
Tlotly
Helper V
3 years ago
Solved

Index match

Good day 

 

I have a dataset (table1) where the Commission is calculated by matching NR of Groups and Groups in Arrears in table 2 . NR of Groups in table 2 is highlighted in Blue and Groups in Arrears is highlighted in Green, values are Commission.

 

Since I'm automating the report into Power BI, I need to replicate the dataset and the formula but I'm struggling to organise the dataset to enble me to do proper PBI calculations.

 

This is the Excel formula used to achieve this: Scheme is table 2 in this post.  

=IF(OR(F10>13,E10<18),0,INDEX(Scheme!$C$39:$DU$53,MATCH(F10,Scheme!$B$39:$B$53,0),MATCH(E10,Scheme!$C$38:$DU$38,0)))

To explain the formula in simple terms. If NR of Groups  = 18 and Groups in Arrears = 1 then Commission will be  R139 etc..

 

The tables below are just snapshots, they are longer hence the formula has cells up to DU38.

 

table1

 

table 2 

 

Any idea on how to go about this?

Thank you

  • Tlotly's avatar
    Tlotly
    3 years ago

    Bifinity_75  thank you. Because Arrears and NR of Groups are two standalone tables, I joined them on SQL table then bought in as Groups_Arrears table. I then joined the table to the Commission's one through the key, as suggested (see below). 

    So now I'm able to create a table visual as below, which is excellent. Thank you for your help.

     

     

4 Replies

  • Hi Totluy, follow this steps:

     

    1- Add a Custon Column to concatenate NR of Groups and Groups in Arrears

     

    2- Go to Table 2, select the first column, and unpivot other columns:

    3- In the Table 2 concatenate NR + GROUP

    4- In Relationship link NR+Groups of the Table 1 with NR+ Groups of the Table 2

    5- Create measure: 

    6- Result

     

    Best regards

    • Tlotly's avatar
      Tlotly
      Helper V

      Thank you very much Bifinity_75 .

      Your solution worked perfectly for organising my data. The only problem is I cannot concatenate table 1 as NR of Groups come from a different table to Groups in Arrears. 

    • Tlotly's avatar
      Tlotly
      Helper V

      Bifinity_75  thank you. Because Arrears and NR of Groups are two standalone tables, I joined them on SQL table then bought in as Groups_Arrears table. I then joined the table to the Commission's one through the key, as suggested (see below). 

      So now I'm able to create a table visual as below, which is excellent. Thank you for your help.

       

       

  • Hi Tlotly , try this:

     

    1.- In Table 2, select the first column like the image, and select  Unpivot other columns:

    2.- Go to Relationship, and create this 2 relationship like the image:

     

    3.- Result

    I forgot to write 49 to value 3...

     

    I hope you it works for you,

     

    Best regards