Forum Discussion

Digger's avatar
Digger
Icon for Post Patron rankPost Patron
5 years ago
Solved

Multiply two tables using userelationship or Treatas

I have to tables

Table1

CurrencyRates

Name | Rate | Date | Custom 

USD | 1,35 | 2021-08-01 | USD2021-08-01

AFN | 0,35 | 2021-08-01 | AFN2021-08-01

BRL| 0,05 | 2021-08-01 | BRL2021-08-01

 

Table2

ID | Date | Amount | Currency | 

1 | 2021-08-01 | 89 | USD | USD2021-08-01

2 | 2021-08-01 | 8059 | AFN | AFN2021-08-01

 

Need add custom column to table2, PriceinEur = Calculate(DIVIDE(Table2[Amount],Table1[Rate]), USERELATIONSHIP(Table2[Custom],Table1[Custom]))

 

But it not work and return wrong sums

 

Also i cant merge tables in PQ as got formula firewall error, as Table1 goin from one source Table2 from another

 

 

6 Replies

    • Digger's avatar
      Digger
      Icon for Post Patron rankPost Patron

      amitchandak   related(Table1[Rate]) not work as does not see relation as i have other relations on same table

  • Hello Digger, 

    have you tried lookupvalue? Something like

    Conversion = DIVIDE ( Table2[Amount] , LOOKUPVALUE(Table1[Rate], Table1[Custom], Table2[Custom]))

     

    Does that help? If so, please

    • mark this post as a solution
    • give kudos

    Thanks hashtag_pete

  • it probably depends how many rows you have on the Conversion rates table (i.e. how many combinations must be looked through)...