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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

LOOKUPVALUE

Hi

 

I'm getting "NaN" from this formula, and i cant see why? Anything obviously wrong here?

 
Invoiced GGR (€) =
SUMX('Fact Workday Transactions',
'Fact Workday Transactions'[In Source Currency] /

LOOKUPVALUE('Exchange Rate'[Exchange Rate],
'Exchange Rate'[ExchangeRateDate],'Fact Workday Transactions'[Date],
'Exchange Rate'[CurrencyCode],'Fact Workday Transactions'[CUR]))
 
Type of columns are as follows:
 
'Fact Workday Transactions'[In Source Currency] = revenue in source currency (number)
'Exchange Rate'[Exchange Rate] = also a number
Dates are Dates...
'Exchange Rate'[CurrencyCode] = Text ABC, I followed an example online form Enterprise DNA and it was also Text
Fact Workday Transactions'[CUR]) = Text also
 
I cant see why this doesnt work? 
 
Relationship created between Calendar and Exchange Rate table (also calander to Fact table)
 
Any suggestions would be welcome.
Thanks in advance!!
Ben
1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Try this:

Invoiced GGR (€) =
VAR __Numerator =
    SUMX (
        'Fact Workday Transactions',
        'Fact Workday Transactions'[In Source Currency]
    )
VAR __Denominator =
    LOOKUPVALUE (
        'Exchange Rate'[Exchange Rate],
        'Exchange Rate'[ExchangeRateDate], 'Fact Workday Transactions'[Date],
        'Exchange Rate'[CurrencyCode], 'Fact Workday Transactions'[CUR]
    )
RETURN
    IF ( __Denominator <> 0, DIVIDE ( __Numerator, __Denominator ) )

 

Or this:

Invoiced GGR (€) =
VAR __Denominator =
    LOOKUPVALUE (
        'Exchange Rate'[Exchange Rate],
        'Exchange Rate'[ExchangeRateDate], 'Fact Workday Transactions'[Date],
        'Exchange Rate'[CurrencyCode], 'Fact Workday Transactions'[CUR]
    )
RETURN
    SUMX (
        'Fact Workday Transactions',
        IF (
            __Denominator <> 0,
            DIVIDE ( 'Fact Workday Transactions'[In Source Currency], __Denominator )
        )
    )

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Try this:

Invoiced GGR (€) =
VAR __Numerator =
    SUMX (
        'Fact Workday Transactions',
        'Fact Workday Transactions'[In Source Currency]
    )
VAR __Denominator =
    LOOKUPVALUE (
        'Exchange Rate'[Exchange Rate],
        'Exchange Rate'[ExchangeRateDate], 'Fact Workday Transactions'[Date],
        'Exchange Rate'[CurrencyCode], 'Fact Workday Transactions'[CUR]
    )
RETURN
    IF ( __Denominator <> 0, DIVIDE ( __Numerator, __Denominator ) )

 

Or this:

Invoiced GGR (€) =
VAR __Denominator =
    LOOKUPVALUE (
        'Exchange Rate'[Exchange Rate],
        'Exchange Rate'[ExchangeRateDate], 'Fact Workday Transactions'[Date],
        'Exchange Rate'[CurrencyCode], 'Fact Workday Transactions'[CUR]
    )
RETURN
    SUMX (
        'Fact Workday Transactions',
        IF (
            __Denominator <> 0,
            DIVIDE ( 'Fact Workday Transactions'[In Source Currency], __Denominator )
        )
    )

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@Icey  - Fantastic. Thank you so much!

 

Actually i like the logic here of creating two VAR as numberator and denominator, I'll apply that logic for other calcs as its a great way to follow through on calcs later on.

 

Really appreciate all comments and replies!

Regards

Ben

 

amitchandak
Super User
Super User

Try like

Invoiced GGR (€) =

var _m =LOOKUPVALUE('Exchange Rate'[Exchange Rate],
'Exchange Rate'[ExchangeRateDate],'Fact Workday Transactions'[Date],
'Exchange Rate'[CurrencyCode],'Fact Workday Transactions'[CUR]))

SUMX(divide('Fact Workday Transactions',
'Fact Workday Transactions'[In Source Currency] ,if(_m=0, blank(),_m)))

 

or handle with IFERROR

Anonymous
Not applicable

Hey,

 

On this one, i dont get the second half of this at all... It doesnt seem to like it.

 

DAX.PNG

 

why is such a simple calcultion so hard to do i wonder..sigh.

Greg_Deckler
Super User
Super User

Try troubleshooting like this:

 

Invoiced GGR (€) =
VAR __Numerator = SUMX('Fact Workday Transactions',
'Fact Workday Transactions'[In Source Currency]
VAR __Denominator = 
LOOKUPVALUE('Exchange Rate'[Exchange Rate],
'Exchange Rate'[ExchangeRateDate],'Fact Workday Transactions'[Date],
'Exchange Rate'[CurrencyCode],'Fact Workday Transactions'[CUR]))
RETURN
__Denominator

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

hmm, thanks, but this is just giving me a value of 1 everywhere now. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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