Forum Discussion

Arnaud31450's avatar
Arnaud31450
Frequent Visitor
4 years ago
Solved

Multiply based on currency check

Hi everyone,   I have values in the table "Price List item" stored as local currencies "Range1_c" e.g. 1,000 In this table I have "CurrencyIsoCode" e.g. EUR   In another Table "Table" I have val...
  • smpa01's avatar
    4 years ago

    Arnaud31450  can you try this measure

    Measure =
    CALCULATE (
        SUMX (
            'Price List item',
            VAR _0 = 'Price List item'[Range1_c]
            VAR _1 =
                CALCULATE (
                    MAX ( 'Table'[Fxb Rate 2022] ),
                    TREATAS ( VALUES ( 'Price List item'[CurrencyIsoCode] ), 'Table'[Currency] )
                )
            RETURN
                _0 * _1
        )
    )
    
  • smpa01's avatar
    smpa01
    4 years ago

    Arnaud31450  looks like you missed a comma after SUMX ('Price List item'

     

    Measure =
    CALCULATE (
    SUMX (
    'Price List item',
    VAR _0 = 'Price List item'[Range1_c]
    VAR _1 =
    CALCULATE (
    MAX ( 'Table'[Fxb Rate 2022] ),
    TREATAS ( VALUES ( 'Price List item'[CurrencyIsoCode] ), 'Table'[Currency] )
    )
    RETURN
    _0 * _1
    )
    )