Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pick Match statement as a chart expression not working

Hi,

I've used a pick(match) statement as i wanted to avoid nested ifs, however following previous posts I cant seem to get mine to work.

vSalesExpressions- is set by an input box to one of the strings defined, I have put this expression as an expression in a line graph.

pick(Match($(vSalesExpressions),'Avg Sales','Median
Sales','Avg Winning Products','Avg Loosing Products','Top 10 Sales','Bottom 10 Sales'),

Avg(ProfitPc),

Median(ProfitPc),

Avg({1<profitindicator = {1} >}ProfitPc),

Avg({1<profitindicator = {0} >}ProfitPc),

Avg({1<SalesPerson = {"=Rank(aggr(avg(ProfitPc),
SalesPerson)) <= 10"
}>}ProfitPc),

Avg({1<SalesId = {"=Rank(aggr(-avg(ProfitPc),SalesId))<=10  "}>} ProfitPc)



  )

Thanks!!

8 Replies
Anonymous
Not applicable
Author

I think that the first parameter of the match() function must be string, not an expression.

Regards,

Michael

swuehl
MVP
MVP

I would try enclosing your variable expansion into single quotes:

pick(Match( '$(vSalesExpressions)' ,'Avg Sales','Median...

Not applicable
Author

Thanks for your suggestion, however it hasnt seemed to have worked.

just to clarify vSalesExpression stores a string.

Not applicable
Author

Thanks for your suggestion, however it hasnt seemed to have worked.

just to clarify vSalesExpression stores a string.

swuehl
MVP
MVP

Seems to work for me (using single quotes around the variable expansion). See attached.

Have you checked that your strings are not differing in trailing / leading spaces or in case?

Not applicable
Author

Thanks for your suggestion, however it hasnt seemed to have worked.

just to clarify vSalesExpression stores a string.

Not applicable
Author

Thankyou guys for all your help,

in replicating my conditions for you swuehl i found that it was nt working becuase I had a space in my strings!!!

when removing space in the string comparisons it worked. so 'avg sales' is now 'avgsales'

I'm not sure why the space posed this issue!

This then leads me to have to think of a way to make the selection box user friendly as having words with no spaces doesnt look very noce.

Not applicable
Author

Sorry back to the drawing bord for me, I have it working but the spaces in the stings was not the issue. Still trying to find out what the issue is>