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
stevevincent16
Regular Visitor

Total for currency converted values are wrong

Monthly values for currency converted values are correctly shown in a matrix, but the total shown is wrong.

I have the local currency and other currencies to convert to. Everything is showing fine for local currencies, but the totals when converting to another currency using SUMX is wrong.

 

Here is the DAX I used:

**Prior Year Sales =
var _selectedYear = SELECTEDVALUE('Main Calendar'[Date].[Year])
var _priorYear = _selectedYear-1

var _priorYearSales = DIVIDE(CALCULATE(SUM(FactSales[Realized Sales]),
    ALL('Main Calendar'[Date].[Year]),
    YEAR(FactSales[Calendar Year / Month])=_priorYear),
    Scale[Scale Value])

var _convertedPriorYearSales =
CALCULATE(SUMX(
        'Exchange Rates Type C Extended With Future Rates',
        _priorYearSales*'Exchange Rates Type C Extended With Future Rates'[Exchange Rate]
    )+0, ALL('Main Calendar'[Date].[Year]), YEAR(FactSales[Calendar Year / Month])=_priorYear
    )

RETURN

SWITCH(TRUE(),
    SELECTEDVALUE('Format'[Format])="Local Currency", _priorYearSales,
   _convertedPriorYearSales
)
 
WrongTotal.gif
 
 

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @stevevincent16 

According to your descrioption, the total in your Matrix is wrong in the _convertedPriorYearSales.

For this may cause the logic in your _convertedPriorYearSales calculation due to the filter context is difference, it is common in Power BI Desktop.

For to solve the wrong total , you can create a separate measure for the _convertedPriorYearSales:

convertedPriorYearSales =
CALCULATE(SUMX(
        'Exchange Rates Type C Extended With Future Rates',
        _priorYearSales*'Exchange Rates Type C Extended With Future Rates'[Exchange Rate]
    )+0ALL('Main Calendar'[Date].[Year]), YEAR(FactSales[Calendar Year / Month])=_priorYear
    )
 
Then we can return this  instead of the _convertedPriorYearSales:
SUMX(VALUES('Table'[Month]),[convertedPriorYearSales ])
 
The 'Table'[Month] is the field you put on the table as the dimension.
 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi , @stevevincent16 

According to your descrioption, the total in your Matrix is wrong in the _convertedPriorYearSales.

For this may cause the logic in your _convertedPriorYearSales calculation due to the filter context is difference, it is common in Power BI Desktop.

For to solve the wrong total , you can create a separate measure for the _convertedPriorYearSales:

convertedPriorYearSales =
CALCULATE(SUMX(
        'Exchange Rates Type C Extended With Future Rates',
        _priorYearSales*'Exchange Rates Type C Extended With Future Rates'[Exchange Rate]
    )+0ALL('Main Calendar'[Date].[Year]), YEAR(FactSales[Calendar Year / Month])=_priorYear
    )
 
Then we can return this  instead of the _convertedPriorYearSales:
SUMX(VALUES('Table'[Month]),[convertedPriorYearSales ])
 
The 'Table'[Month] is the field you put on the table as the dimension.
 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors