Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
bc5891
Contributor III
Contributor III

Set Analysis when using pick(match....... function

Hi,

I am creating a chart which should not be affected by a month year selection 

like below:

bc5891_0-1592919069021.png

 

When I use the following expression it works:

sum({$<[Month Year]= , PeriodDateNum={">=$(vPrior12MonthYearNum)"} >} [A] ) 

 

But when I try to introduce pick  at the start of my expression, the same expression doesn;t work, it gets affected by the date selection.


PICK(MATCH(DIM, 'A', 'B'),

sum({$<[Month Year]= , PeriodDateNum={">=$(vPrior12MonthYearNum)"} >} [A] ) ,

sum({$<[Month Year]= , PeriodDateNum={">=$(vPrior12MonthYearNum)"} >} [B] ) 

)

Does anyone have a specific reason why this will not work or have a workaround?  I need the dynamic nature of the pick and match function in my chart.

Thanks

Labels (2)
6 Replies
tresesco
MVP
MVP

Try like:

PICK(MATCH( Only({1} DIM ), 'A', 'B'),

sum({$<[Month Year]= , PeriodDateNum={">=$(vPrior12MonthYearNum)"} >} [A] ) ,

sum({$<[Month Year]= , PeriodDateNum={">=$(vPrior12MonthYearNum)"} >} [B] ) 

)

bc5891
Contributor III
Contributor III
Author

Thanks for the response - I did see something similar to this. 

When I put the only ({1} field) addition, it does not work unfortunately - it actually shows no data then.

 

It's frustrating as the chart works perfectly without the pick(match function...but at the same time this is required!

tresesco
MVP
MVP

Could you share your app sample?

bc5891
Contributor III
Contributor III
Author

Work policies don't enable me to do that.

 

some more details if it helps:

I am using an inline table as a data island.

- I have a calendar for monthyear

- The combo chart is using monthyear. 

- The chart expression changes as per selection of the dimension in the data island.

- chart works if single set analysis expression and disregards monthyear

- chart does not work when using pick(match(....function using the data island, it filters down to single month.

 

There seems to be a similar thread on this which was unresolved as well...

 

Thanks

jazzsran
Partner - Contributor III
Partner - Contributor III

Hi

I hope this is resolved as this is an old thread. Although for record, I am adding here some suggestions that worked for me.

1. Only({1}Dim) - works fine if you want to ignore selections.

2. When using pick-match statement, if you need to use expression as value, add it in a variable and use the variable instead; direct expressions doesn't work.

Eg: Pick(Match(Only({1}Dim, '1','2')),$(Variable1),$(Variable2))

 

Hope this helps. 

Thanks,

Jaspreet

tresesco
MVP
MVP

Hi @jazzsran , thank you for sharing your solution. However, the statement :

When using pick-match statement, if you need to use expression as value, add it in a variable and use the variable instead; direct expressions doesn't work

 might not be right. I would assume that the effect you saw could be because of the way you wrote your expression and/or variable definition. As general statement - this is probably mis-leading. I would like to ask you to share a sample qvf that demonstrates the issue and solution you have worked on.