Forum Discussion
Lookupvalue based on variable slicer selection showing blanks ?
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));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:
=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")