Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

variables does not work when not selected in a dimension

Hi

I have 2 variables created based DATE column , to select a range of dates and calculate metrics in the charts

when i use the variables in expression of the chart and have DATE as one of the dimension then charts reflect data properly.If i remove the Date from dimesions , then chart does not reflect the metrics as expected

Any help on this please?

Thanks

2 Replies
prieper
Master II
Master II

In general Expression must deliver a result without ambiguity - thus typically expressions must always have a kind of aggregation-formula in it. If referencing to just one value, it will show only this value, if the selection itself delivers a unique result.

HTH
Peter

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi There,

Peter's response is entirely correct. It may be however that you are simply missing an aggregation statement in the expression. For instance, try removing the Date dimension and wrapping your expression in a Sum function.

Eg. =sum(if([Date] >= vDateFrom or [Date] <= vDateTo, Value, 0))

Hope that helps,

Steve