Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Lookupvalue based on variable slicer selection showing blanks ?

Hi, I am trying to make a report in PowerPivot where I dynamically select a reporting currency, and with a variable measure this will multiply my amount in SEK to any currency that I select in the slicer. 

 

I have multiple currencies in my fact table (see tables below) and have converted those already to one global SEK amount which you can see in the "SEK amount" column. So the only thing left is to convert this SEK amount based on the currency I select in a slicer. 

 

The Facts table is already linked with the exchange rate table through the "Currency Key".

However to make this work I created an extra table with all the reported currencies which is not linked to any table so that I can create the following measure:

 

Selected_Currency_reported:

=if(HASONEVALUE('Dim Currencies'[Currency]);VALUES('Dim Currencies'[Currency]);BLANK())

 

And then for the conversion measure below:

 

When I select GBP it is returning "test" which it should be as I did not yet include that currency to be selected.

However, I am getting blank values when multiplying my SEK amount with the looked-upvalue (or at least I think it selects a rate) exchange rate from the table. When I try to divide by the lookupvalue it gives a "NUM"-error.

 

The measure itself is working without any initial error, but somehow it is only returning me blanks when I select a relevant currency. Can anyone see what I'm doing wrong here?

3.PNG

 

=VAR selection = [Selected_Currency_reported]

return

switch(true();

selection = "CHF";SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];'Dim Exchange rates'[Datekey];'Fact PL Data'[currency key date];'Dim Exchange rates'[Currency];[Selected_Currency_reported]));
selection = "CZK"; SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];'Dim Exchange rates'[Datekey];'Fact PL Data'[currency key date];'Dim Exchange rates'[Currency];[Selected_Currency_reported]));
selection = "EUR";SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];'Dim Exchange rates'[Datekey];'Fact PL Data'[currency key date];'Dim Exchange rates'[Currency];[Selected_Currency_reported]));
selection = "HUF";SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];'Dim Exchange rates'[Datekey];'Fact PL Data'[currency key date];'Dim Exchange rates'[Currency];[Selected_Currency_reported]));BLANK())

 

I have the following Exchange rate table:

Exch rate tableExch rate tableFacts tableFacts tableCurrency table (not linked)Currency table (not linked)

2 REPLIES 2
parry2k
Super User
Super User

@Anonymous your formula looks ok not sure what is missig, why not replace following to var

 

selection = "CHF";SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];
'Dim Exchange rates'[Datekey];'Fact PL Data'[currency key date];'Dim Exchange rates'[Currency];selction));


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Could you explain what you are trying to do with the var function now?

 

I managed to get it to work. I used lookupvalue on the wrong column which was not in the same format.

 

However => Is there an easier or prettier way to make this formula variable? Cause now if I would have a new currency in my selection, I would have to manually update my formula here:

1.PNG

 

 

=VAR selection = [Selected_Currency_reported]

return

switch(true();

selection = "CHF";SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];'Dim Exchange rates'[Datekey];'Fact PL Data'[Datekey currency];'Dim Exchange rates'[Currency];[Selected_Currency_reported]));
selection = "CZK"; SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];'Dim Exchange rates'[Datekey];'Fact PL Data'[Datekey currency];'Dim Exchange rates'[Currency];[Selected_Currency_reported]));
selection = "EUR";SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];'Dim Exchange rates'[Datekey];'Fact PL Data'[Datekey currency];'Dim Exchange rates'[Currency];[Selected_Currency_reported]));
selection = "GBP";SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];'Dim Exchange rates'[Datekey];'Fact PL Data'[Datekey currency];'Dim Exchange rates'[Currency];[Selected_Currency_reported]));
selection = "HUF";SUMX('Fact PL Data';'Fact PL Data'[SEK amount]*LOOKUPVALUE('Dim Exchange rates'[Exch. Rate];'Dim Exchange rates'[Datekey];'Fact PL Data'[Datekey currency];'Dim Exchange rates'[Currency];[Selected_Currency_reported]));"Incorrect values")

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.