March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi I have a DAX measure which works fine in a visualshowing the position of a single month but I get a message saying my visual has run out of resources when adding multiple months to the visual. Is this the most efficient formula below and are there ways I can make this same calculation less resource intensive?
Essentially I am converting a measure to a single currency. I have split the measure into multiple sections as there are multiple currencies. The exchange rate is calculated by taking the average from the present month (max month in filters).
It's divided by 1000 at the end as numbers are to be represented in 1000s
up to line 55 I am converting to the currency of the exchange rate table
56-66 converts the result to USD
67-74 adds data that already exists in USD
Aging ($'000) =
(
(
(
CALCULATE (
[Aging LCY 0],
FILTER ( 'company', 'company'[LCY_Code] = "SGD" ),
FILTER ( customer_entries, customer_entries[Currency_Code] <> "USD" )
)
/ CALCULATE (
SUM ( 'Exchange Rates'[Exchange_Rate_Amount] )
/ COUNT ( 'Exchange Rates'[Exchange_Rate_Amount] ),
DATESBETWEEN (
'Exchange Rates'[Starting_Date],
EOMONTH ( MAX ( customer_entries[Posting_Date] ), -1 ) + 1,
EOMONTH ( MAX ( customer_entries[Posting_Date] ), 0 )
),
FILTER ( 'Exchange Rates', 'Exchange Rates'[Currency_Code] = "SGD" )
)
+ CALCULATE (
[Aging LCY 0],
FILTER ( 'company', 'company'[LCY_Code] = "AED" ),
FILTER ( customer_entries, customer_entries[Currency_Code] <> "USD" )
)
/ CALCULATE (
SUM ( 'Exchange Rates'[Exchange_Rate_Amount] )
/ COUNT ( 'Exchange Rates'[Exchange_Rate_Amount] ),
DATESBETWEEN (
'Exchange Rates'[Starting_Date],
EOMONTH ( MAX ( customer_entries[Posting_Date] ), -1 ) + 1,
EOMONTH ( MAX ( customer_entries[Posting_Date] ), 0 )
),
FILTER ( 'Exchange Rates', 'Exchange Rates'[Currency_Code] = "AED" )
)
+ CALCULATE (
[Aging LCY 0],
FILTER ( 'company', 'company'[LCY_Code] = "INR" ),
FILTER ( customer_entries, customer_entries[Currency_Code] <> "USD" )
)
/ CALCULATE (
SUM ( 'Exchange Rates'[Exchange_Rate_Amount] )
/ COUNT ( 'Exchange Rates'[Exchange_Rate_Amount] ),
DATESBETWEEN (
'Exchange Rates'[Starting_Date],
EOMONTH ( MAX ( customer_entries[Posting_Date] ), -1 ) + 1,
EOMONTH ( MAX ( customer_entries[Posting_Date] ), 0 )
),
FILTER ( 'Exchange Rates', 'Exchange Rates'[Currency_Code] = "INR" )
)
+ CALCULATE (
[Aging LCY 0],
FILTER ( 'company', 'company'[LCY_Code] = "GBP" ),
FILTER ( customer_entries, customer_entries[Currency_Code] <> "USD" )
)
)
* CALCULATE (
SUM ( 'Exchange Rates'[Exchange_Rate_Amount] )
/ COUNT ( 'Exchange Rates'[Exchange_Rate_Amount] ),
DATESBETWEEN (
'Exchange Rates'[Starting_Date],
EOMONTH ( MAX ( customer_entries[Posting_Date] ), -1 ) + 1,
EOMONTH ( MAX ( customer_entries[Posting_Date] ), 0 )
),
FILTER ( 'Exchange Rates', 'Exchange Rates'[Currency_Code] = "USD" )
)
)
+ (
CALCULATE ( [Aging LCY 0], FILTER ( 'company', 'company'[LCY_Code] = "USD" ) )
+ CALCULATE (
[Aging 0],
FILTER ( customer_entries, customer_entries[Currency_Code] = "USD" ),
FILTER ( 'company', 'company'[LCY_Code] <> "USD" )
)
)
) / 1000
Solved! Go to Solution.
Check if this can help
Aging ($000) =
VAR CurrentEOMonth = EOMONTH(MAX(customer_entries[Posting_Date]), 0)
VAR PrevEOMonth = EOMonth(MAX(customer_entries[Posting_Date]), -1) + 1
VAR USDExchangeRate =
CALCULATE(
SUM('Exchange Rates'[Exchange_Rate_Amount]) / COUNT('Exchange Rates'[Exchange_Rate_Amount]),
'Exchange Rates'[Starting_Date] >= PrevEOMonth,
'Exchange Rates'[Starting_Date] <= CurrentEOMonth,
'Exchange Rates'[Currency_Code] = "USD"
)
VAR ConvertedToUSD =
SUMX(
VALUES('company'[LCY_Code]),
VAR LCY_Code = 'company'[LCY_Code]
VAR ExchangeRate =
CALCULATE(
SUM('Exchange Rates'[Exchange_Rate_Amount]) / COUNT('Exchange Rates'[Exchange_Rate_Amount]),
'Exchange Rates'[Starting_Date] >= PrevEOMonth,
'Exchange Rates'[Starting_Date] <= CurrentEOMonth,
'Exchange Rates'[Currency_Code] = LCY_Code
)
VAR AgingLCY = CALCULATE([Aging LCY 0], 'company'[LCY_Code] = LCY_Code)
RETURN IF(LCY_Code <> "USD", AgingLCY / ExchangeRate, BLANK())
) * USDExchangeRate
VAR DirectUSDAmounts =
CALCULATE([Aging LCY 0], 'company'[LCY_Code] = "USD") +
CALCULATE([Aging 0], customer_entries[Currency_Code] = "USD", 'company'[LCY_Code] <> "USD")
RETURN (ConvertedToUSD + DirectUSDAmounts) / 1000
Check if this can help
Aging ($000) =
VAR CurrentEOMonth = EOMONTH(MAX(customer_entries[Posting_Date]), 0)
VAR PrevEOMonth = EOMonth(MAX(customer_entries[Posting_Date]), -1) + 1
VAR USDExchangeRate =
CALCULATE(
SUM('Exchange Rates'[Exchange_Rate_Amount]) / COUNT('Exchange Rates'[Exchange_Rate_Amount]),
'Exchange Rates'[Starting_Date] >= PrevEOMonth,
'Exchange Rates'[Starting_Date] <= CurrentEOMonth,
'Exchange Rates'[Currency_Code] = "USD"
)
VAR ConvertedToUSD =
SUMX(
VALUES('company'[LCY_Code]),
VAR LCY_Code = 'company'[LCY_Code]
VAR ExchangeRate =
CALCULATE(
SUM('Exchange Rates'[Exchange_Rate_Amount]) / COUNT('Exchange Rates'[Exchange_Rate_Amount]),
'Exchange Rates'[Starting_Date] >= PrevEOMonth,
'Exchange Rates'[Starting_Date] <= CurrentEOMonth,
'Exchange Rates'[Currency_Code] = LCY_Code
)
VAR AgingLCY = CALCULATE([Aging LCY 0], 'company'[LCY_Code] = LCY_Code)
RETURN IF(LCY_Code <> "USD", AgingLCY / ExchangeRate, BLANK())
) * USDExchangeRate
VAR DirectUSDAmounts =
CALCULATE([Aging LCY 0], 'company'[LCY_Code] = "USD") +
CALCULATE([Aging 0], customer_entries[Currency_Code] = "USD", 'company'[LCY_Code] <> "USD")
RETURN (ConvertedToUSD + DirectUSDAmounts) / 1000
Thanks! Had to make a minor change as a filter was missing in ConvertedToUSD, it's working in the service now.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |