Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Gartner® Magic Quadrant™: 15 YEARS A LEADER - GET THE REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
satishkurra
Specialist II
Specialist II

Pick Function QlikSense

Hi Team

I'm trying to use Pick Function as below. 

My Variable is vPostService. It has values as either 1 or 2

Post Date and Service Date are my dimensions.

avg(aggr(sum(Sales), Pick(vPostService,PostDate,ServiceDate)))

Appreciate the help

 

Tried vPostService as $(vPostService) and no luck

 

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@satishkurra  or with below pick in reference line expression

pick(vPostService,

avg(total aggr(sum(Sales), [Post Date])) + 3*stdev(total aggr(sum(Sales), [Post Date]),

avg(total aggr(sum(Sales), [Service Date])) + 3*stdev(total aggr(sum(Sales), [Service Date])))

 

 

View solution in original post

9 Replies
Vegar
MVP
MVP

I see what you are trying to do. I have not seen this pattern before.

The issue here is that in your pick() expects an string input, not a field reference. Try this adjustment:

avg(aggr(sum(Sales), Pick($(vPostService),'PostDate','ServiceDate')))

Or this:

avg(aggr(sum(Sales), [$(=Pick($(vPostService),'PostDate','ServiceDate'))] ))

satishkurra
Specialist II
Specialist II
Author

Hi @Vegar 

Tried both options and no luck

Kushal_Chawda

@satishkurra  try like below

=pick(vPostService,
avg(aggr(sum(Sales), [Post Date])),
avg(aggr(sum(Sales), [Service Date])))
satishkurra
Specialist II
Specialist II
Author

Hi @Kushal_Chawda , Tried and no luck

Kushal_Chawda

@satishkurra  can you send screenshot of your expression? In which chart you are using this expression? Make sure that variable always holds any values if it has null value expression will not work.

satishkurra
Specialist II
Specialist II
Author

Sure.

 

Dimension: =pick(vPostService,[Post Date],[Service Date])

Expression: Sum(Sales)

Reference Line: avg(aggr(sum(Sales), [Post Date])) + 3*stdev(aggr(sum(Sales), [Post Date]))

For Reference Line expression, I'm trying to Switch with a button to change the dimension between Post Date and Service Date like I entered in the Dimension. It is displaying the chart but the reference line is not showing up.

Please let me know if this info helps

Kushal_Chawda

@satishkurra try below in reference line

avg(total aggr(sum(Sales), [Post Date])) + 3*stdev(total aggr(sum(Sales), [Post Date]))

Kushal_Chawda

@satishkurra  or with below pick in reference line expression

pick(vPostService,

avg(total aggr(sum(Sales), [Post Date])) + 3*stdev(total aggr(sum(Sales), [Post Date]),

avg(total aggr(sum(Sales), [Service Date])) + 3*stdev(total aggr(sum(Sales), [Service Date])))

 

 

satishkurra
Specialist II
Specialist II
Author

This worked. Thanks a ton @Kushal_Chawda