Forum Discussion
Gonqq
Helper I
5 years agoOptimizing a DAX Formula
Hi everyone. I'm having trouble with a small dax formula: it consumes a lot of memory and i can't add anymore rows to a mtarix because of it. The formula is the following: It was one of my fir...
mahoneypat
Microsoft Employee
5 years agoI'm surprised this is slow, so I'm assuming you have many combinations of values based on the columns used in the matrix. I would first look at the query behind the matrix using Performance Analyzer and try to reduce granularity. If that can't be improved, I would use nested IF functions instead of SWITCH(TRUE(). Your expression forces all 3 variables to be evaluated every time. Try to nest them so that you eliminate the most early on.
NewExpression =
IF (
SELECTEDVALUE ( Contas[Grupo Conta] ) <> 62,
"N/A",
IF (
SUM ( Principal[Real] ) > 0,
"N/A",
IF (
SUM ( Principal[PO] ) > 0,
"N/A",
GE
)
)
)
Pat