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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Briosjuly77
Frequent Visitor

How to use multi-IF condition in SUMX

Hi All

 

I have a table,  unit* unit price, but the currency of unit price is different.

I want to creat a measure use SUMX to calculate the Product total price.

total price currency is SGD, 1 USD=1.32 SGD, 1 EUR=1.53 SGD

 

 

Product unitUnit Pricecurrency
A1005USD
B506SGD
C2007USD
D5008EUR

 

 

I know how to add one if condition in sumx function, but I dont know how to add multiper if condition.

I've created a measure like this: Product price = SUMX( Table A, IF(Table A[Currency]="USD", Table A[Unit Price]*1.32*[unit])),

the results only show the USD product....

 

how to resovle? 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Briosjuly77,

 

Try this measure:

 

Product Price = 
VAR vCurrency =
    MAX ( TableA[currency] )
VAR vRate = 
    SWITCH ( vCurrency,
        "SGD", 1,
        "USD", 1.32,
        "EUR", 1.53
    )
VAR vResult =
    SUMX ( TableA, TableA[unit] * TableA[Unit Price] * vRate )
RETURN
    vResult

 

DataInsights_0-1603118156976.png

Consider creating an exchange rate table, instead of hardcoding rates in the measure.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@Briosjuly77,

 

Try this measure:

 

Product Price = 
VAR vCurrency =
    MAX ( TableA[currency] )
VAR vRate = 
    SWITCH ( vCurrency,
        "SGD", 1,
        "USD", 1.32,
        "EUR", 1.53
    )
VAR vResult =
    SUMX ( TableA, TableA[unit] * TableA[Unit Price] * vRate )
RETURN
    vResult

 

DataInsights_0-1603118156976.png

Consider creating an exchange rate table, instead of hardcoding rates in the measure.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors