Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have several expressions that use if statements, where two different set analysis calculations are performed based on field selection count. Is there a way to rewrite this expression without using an if statement?
=if(count(getfieldselections([TestFIeld1]))=0,num(FABS(SUM({1<Year={"=GetFieldSelections(Year)"},Scenario={'X'},[TestFIeld1]-={'Retail'}>}Sales))/1000000,'###,###.#'),num(FABS(SUM({1<Year={"=GetFieldSelections(Year)"},Scenario={'X'},[TestFIeld1]=$::[TestFIeld1]>}Sales))/1000000,'###,###.#'))
Thanks,
GetFieldSelections() will not give when you use aggregate, rather you can try this way
=if(GetSelectedCount(TestField1)=0,num(FABS(SUM({1<Year={"=GetFieldSelections(Year)"},Scenario={'X'},[TestFIeld1]-={'Retail'}>}Sales))/1000000,'###,###.#'),num(FABS(SUM({1<Year={"$(=Concat(DISTINCT Chr(39) & Year & Chr(39), '',''))"},Scenario={'X'},[TestFIeld1]=$::[TestFIeld1]>}Sales))/1000000,'###,###.#'))
GetFieldSelections() will not give when you use aggregate, rather you can try this way
=if(GetSelectedCount(TestField1)=0,num(FABS(SUM({1<Year={"=GetFieldSelections(Year)"},Scenario={'X'},[TestFIeld1]-={'Retail'}>}Sales))/1000000,'###,###.#'),num(FABS(SUM({1<Year={"$(=Concat(DISTINCT Chr(39) & Year & Chr(39), '',''))"},Scenario={'X'},[TestFIeld1]=$::[TestFIeld1]>}Sales))/1000000,'###,###.#'))
Thanks for your feedback!
I should have stated this in my original post but the motivation behind this post was given what I have read elsewhere in the community about if statement impacting performance. Thus, I was trying to understand if the expression I listed is one of those situation that would need to be rewritten without including if statement. But as I think about it more perhaps that may not be applicable in this situation as I am essentially two different evaluations based on the applicable condition.
Nevertheless, I appreciate your input and will consider giving it a try in my next work.
Thanks,
First of all, I don't see any performance issue. did you?