Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
MartinW1
Contributor III
Contributor III

Weird Pick(Match()) behaviour with measures

I'm getting some really weird behaviour using Pick(Match()) with some measures, and feel like I've tried everything.

I have a table in Qlik Sense which I am using to show various metrics and compare to either a target or a comparison period. The comparison columns are being handled with measures that switch depending on what the user selects. Examples of the measures I'm using are:

[Qty] = Sum([Sales.Qty])
[QtySwitch] = Pick(Match([Comparator], 'vs Target', 'vs Comp'), [QtyTarget], [QtyComp])
[QtyComp] = Sum({<[Calendar.Period] =, [Calendar.SalesDate.autoCalendar.Date] = {">=$(vCompStartDate)<=$(vCompEndDate)"}>} [Sales.Qty])

Now the weird behaviour. When 'vs Comp' is selected, where there is no [Qty] on a particular line (ie there are no sales on the currently selected period), [QtySwitch] is returning null. However, the line does show (just with null values). Also, lines with a value for [Qty] are fine, and the total is correct (so the lines don't add up to the total). And the really weird bit is that if I put [QtyComp] in a column on it's own, it works perfectly. Also tried changing the Pick(Match()) to nested ifs and that doesn't work either (same behaviour).

MartinW1_0-1771526502831.png

 

Have I missed something obvious? Is this just a bug? Any suggestions for getting round the issue?

Labels (3)
11 Replies
MartinW1
Contributor III
Contributor III
Author

That's it! [Comparator] is returning null for lines with no data in the current period. Now my question is why? That is a disconnected table built in the load script, I'd expect it to return the current selection regardless of other filters/sums on the page or table.

 

Anyway, solution is:

[QtySwitch] = Pick(Match(GetFieldSelections([Comparator]), 'vs Target', 'vs Comp'), [QtyTarget], [QtyComp])

Thanks for your help.

marcus_sommer

If this isolated table is used within an object it's then related/joined and if there is no dimension-value for the chart-dimension no other reference could be set because nothing exists against anything could be related.

Therefore the above hint to populate missing values as the usually simplest way to be able to address any context to them.