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
ManuelGeiger
Helper I
Helper I

Support with simplifying my DAX code

Hi all,

 

I was hoping that somebody could help me simplify my dax code because I get an error when publishing my report to the workspace (memory is not enough).

I got two tables: 

One with my stock value (with local currencies)

One with my currency conversion rates

 

I want to simply convert my stock value in local currency to SEK currency (first measure) but because of the issue we have regarding measure and totals in tables I use a second measure with SUMX to sum the results of the first measure.

 

First measure:

Stock Value SEK - no sum =
VAR
    _currency = MAX('BIG Item Stockroom Balance'[CurrencyCode])
VAR
    _conversionRate =
        CALCULATE (
            MAX( 'BIG Exchange Rate'[SekRate] )
            ,'BIG Exchange Rate'[CurrencyCode] = _currency
        )
VAR
    _StockValueSEK =
        _conversionRate * SUM('BIG Item Stockroom Balance'[StockValueLocal])
Return
_StockValueSEK

Second Measure:
Stock Value SEK =
SUMX('BIG Item Stockroom Balance',[Stock Value SEK - no sum])
 
Thanks in advance!
2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

do you have any dimension tables?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






I have uploaded the power bi file here:

 

https://1drv.ms/u/s!AsJBaG2jts__tDwkchq0JOacee7Y?e=HhOz8R

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.