Forum Discussion

RanjanThammaiah's avatar
6 years ago

Currency expression not working

Hi All,

 

Can some one help me with the below expression. When i try to add this as measure the total value is gryed out.

Am i missing something in the formula?

 

Total Value(Selected Currency) = SWITCH(TRUE(),[Selected Currency]="NZD",SUM(Sheet1[Total Value]*[Selected Currency]),[Selected Currency]="USD",SUM(Sheet1[Total Value]*[Selected Currency]),SUM(Sheet1[Total Value]))
 

 

 

2 Replies

  • rajulshah's avatar
    rajulshah
    Resident Rockstar

    Hello RanjanThammaiah,

    Please try following:

    Measure =
    //Following statement gives "USD","NZD" etc
    VAR SelectedCurrency = [Selected Currency]
    //Following statement gives value of currency
    VAR SelectedCurrencyValue =
        CALCULATE (
            MIN ( Sheet1[CurrencyValue] ),
            FILTER (
                Sheet1,
                Sheet1[Currency] = SelectedCurrency
            )
        )
    RETURN
        SWITCH (
            SelectedCurrency,
            "NZD", SUM ( Sheet1[Total Value] ) * SelectedCurrencyValue,
            "USD", SUM ( Sheet1[Total Value] ) * SelectedCurrencyValue,
            SUM ( Sheet1[Total Value] )
        )

     

    Please note that I have used my column names. You may need to change those.

     

    Let me know if this doesn't work as expected.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi RanjanThammaiah ,

     

    Could you please share the "Selected Currency" measure to us?

     

    And I think the result of the "Selected Currency" is a string, not a rate, you may need to a rate to multiply the Total Value.

     

    Aiolos Zhao