powerbidax

FX rates downloaded base on criteria


I would like to recevie "Bgt Avg YTD" for specific material. And later use it for calculation (Bgt Avg YTD * Value)

FX Rates

Currency Bgt Avg YTD Reporting date
USD 1,12 31.01.2024
USD 1.23 31.03.2024
EUR 1,12 31.01.2024
EUR 1.23 31.03.2024

Currency

Currency
USD
EUR

Reporting date

Reporting date
31.01.2024
31.03.2024

GRIP

Material No Purchase curr Plant Reporting date Value
123A USD 1111 31.01.2024 100
123A USD 2222 31.01.2024 350
122B USD 1111 31.01.2024 400
123A EUR 4444 31.01.2024 140
122B EUR 4444 31.01.2024 840
122B EUR 6666 31.01.2024 660

The challenge that I have is that Currency is not unique in "FX Rates" table and I would like to receive it base on slicer "Reporting date". GRIP has only one Reporting date (31.01.2024).

Connections that I have are

Connections

I've tried to create measure

Miara test = CALCULATE(SUM('FX Rates'[Bgt Avr YTD]),DATESMTD('Reporting date'[Reporting date])) 

But I receive some total value, not correct FX rate.


Solution

  • I created two calculated columns on the GRIP table. To get the Bgt Avg YTD on the GRIP table, I recommend using a LOOKUPVALUE function searching both the Currency and the Reporting Date to bring back one value.

    Bgt Avg YTD = 
    LOOKUPVALUE('FX Rates'[Bgt Avg YTD], 'FX Rates'[Currency], GRIP[Purchase curr], 'FX Rates'[Reporting date], GRIP[Reporting date])
    
    calculation = GRIP[Value] * GRIP[Bgt Avg YTD]
    

    output