Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a expression as follows
if(aggr(Rank(Sum({1} Spend)),Supplier)<=20, expression & 'your in top 20', expression)
The above expression is working fine and displaying the expression with message if the selected supplier is in top 20.
But I have to write the similar kind of expressions for Manufacturer , Product, Commodity.
so I created a variable like this
vCPSelected = if(GetFieldSelections(Commodity)>0,'Commodity',if(GetFieldSelections(Product)>0,'Product',if(GetFieldSelections(Manufacturer)>0,'Manufacturer','Supplier')))
and I replaced the aggr dimension with the above variable
if(aggr(Rank(Sum({1} Spend)),$(vCPSelected))<=20, expression & 'your in top 20', expression) but when I selected a supplier (for eg) in top 20 , I am unable to get the first expression in "if" condition.
along with this I have also a line saying
<selected supplier> spend is expression.
Note: All these I am using in a text box
Thanks
Kiran Kumar
Thanks Marcus , I used getselectedcount() but in a hurry I typed getcurrentselections.
I have got the solution in the same way as u suggested but I have used like as
$(=$(vCPSelected)) and to show the for eg Supplier is in top 20 , I have used $(vCPSelected).
By using "=" aggr is considering the value of the variable as dimension where as $(vCPSelected) is just returning a string
which aggr is not treating as dimension.
Thanks
Kiran Kumar
If your variable started with "=" it should work. That meant the variable will be evaluated and the result will be used with your aggr-expression and without an equal sign only the expression as string will be applied - in such cases could you use $(='$(vCPSelected)').
Further getfieldselections returned a string of the selected values - if you want to count if there is any selection you need getselectedcount().
- Marcus
You are saying that this is working -> if(aggr(Rank(Sum({1} Spend)),Supplier)<=20, expression & 'your in top 20', expression)
but this isn't? -> if(aggr(Rank(Sum({1} Spend)),$(vCPSelected))<=20, expression & 'your in top 20', expression)
Can you check if your variable $(vCPSelected) shows 'Supplier' when you have one selected?
Thanks Marcus , I used getselectedcount() but in a hurry I typed getcurrentselections.
I have got the solution in the same way as u suggested but I have used like as
$(=$(vCPSelected)) and to show the for eg Supplier is in top 20 , I have used $(vCPSelected).
By using "=" aggr is considering the value of the variable as dimension where as $(vCPSelected) is just returning a string
which aggr is not treating as dimension.
Thanks
Kiran Kumar
Hi Kiran,
Try like below
Sum(aggr(if(Rank(Sum({1} Spend))<=20, expression & 'your in top 20', expression),$(vCPSelected)))