Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
When I use the below expression in a chart, it gives an error that allocated memory exceeded
if(GetSelectedCount(%SubDimension) > 0,
SUM(TOTAL <$(=%SubDimension)> Spend),
SUM(Spend)
)
However, the below expression works
if(GetSelectedCount(%SubDimension) > 0,
SUM(TOTAL Spend),
SUM(Spend)
)
This one alone also works
SUM(TOTAL <$(=%SubDimension)> Spend)
The only problem becomes when I use the dollar sign expansion inside the total and if it is inside an if statement
TOTAL <$(=%SubDimension)>
Any idea how to fix this?
If the variable contains the name of a single dimension field, omit the equal sign inside the $-expansion.
It is not a variable. It is a field that contains the names of the dimensions. It has the names of six dimensions but the user can select which dimension should the chart show
Dollar equal sign then converts the selected value from the list to the dimension
The expression alone works exactly the way we want. However, inside the if statement, it stops to work if we have this kind of expression
Hi Syed,
Is this expression being used in a PIVOT table? with your dimension which holds Supplier, Product values moved to headers?
Add two expressions with conditional enabled to overcome the memory issue
Expression1:
Conditional = if(GetSelectedCount(%SubDimension) > 0, 1 , 0)
Expression = SUM(TOTAL <$(=%SubDimension)> Spend)
Expression2:
Conditional = if(GetSelectedCount(%SubDimension) > 0, 0 , 1)
Expression = SUM(Spend)
Hi syed,
I just created the sample. I think, it is working fine for me. Can you provide your sample which is not working for you..
Update:
it is not going to else part, if there is no selection because of null. that will create the expression like
The above one is error expression. that's why getting null result.
Based on Peter's suggestion, you can add the variable and use it in your expression.
What happens if you replace $(=%SubDimension) with $(vSelectedDimension) and in Settings->Variable Overview you defined vSelectedDimension as
=%SubDimension
Might be easier to trace substitutions.
Best,
Peter