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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

Issue regarding Gauge chart

Hello All,

I am working on Gauge chart in Qliksense. I have used reference lines in Gauge chart. I am using following expression:

"Sum({<Year = {'$(vPrevYear)'}, MonthNumber = {'<=$(=vCurMonth)'}, [Transaction Type] = {'Sales'}>}Amount)"

where "$(vPrevYear)" = '2017'. But issue i am facing is this is working when i am selecting any year in the filter. But i have make the expression such that it should always work even if Year value not selected in the Year Filter. can anyone help em in this?


vPrevYear =Year(Date(Today(), 'MM/DD/YYYY'))-1

vCurMonth = Num(Month(Today()))

5 Replies
shraddha_g
Partner - Master III
Partner - Master III

how have you defined this variable?

in Script or Variable Overview?

Try,

Sum({<Year = {"$(=vPrevYear)"}, MonthNumber = {'<=$(=vCurMonth)'}, [Transaction Type] = {'Sales'}>}Amount)

nikhilgarg
Specialist II
Specialist II
Author

Hello Shraddha,

I have used following

vPrevYear =Year(Date(Today(), 'MM/DD/YYYY'))-1

vCurMonth = Num(Month(Today()))


and above formula giving us correct values, so i don't think there is some issue with formula. I would request you if you can make some dummy gauge chart and add reference lines and check if they works without selecting filter value of year

marinadorcassio1
Partner - Creator
Partner - Creator

That's quite strange, because since you make your variable using today(), there is no need to select a year for it to work.

When you don't select any year, there is no value on your gauge, that's it ? May you share a picture of the problem you're facing please ?


Regards,

Marina

nikhilgarg
Specialist II
Specialist II
Author

Hey Shraddha,

In the Gauge chart, i ahve simply placed the value in reference line, but still reference line not visible. Pls.find attached snapshot

nikhilgarg
Specialist II
Specialist II
Author

Hey Marina,

In the Gauge chart, i ahve simply placed the value in reference line, but still reference line not visible. Pls.find attached snapshot