Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vvira1316
Specialist II
Specialist II

Previous year line chart expression in QlikSense that will show accumulated value in combo chart

Hi

I'm selecting a year using Filter pane that [Launch Cal Year] field.

I'm getting correct bar chart for selected year. I'm trying to get a line chart for previous year values that will be accumulative for that year. I've AsOfMonth calendar

I want bar chart for selected year (2017) (it is working), and line chart for previous year (2016).

Selected year Bar Chart Expression

=RangeSum(Above(Count(

{<

[Opportunity Record Type]={'Vendor Opportunity'}

,[Launch Cal Year]={"=$(vGetSelectedYear)"}

>}

Distinct [Opportunity Id]

)

,0, RowNo()), AsOfMonth)            

vGetSelectedYear Definition is GetFieldSelections([Launch Cal Year])

vGetPreviousYearFromSelectedYear definition is $(vGetSelectedYear) - 1

SS9.PNG

2017 Bar chart is correct

SS7.PNG

SS1.PNG

2016 Bar Chart for reference. It is showing correct values. I want this values to show up in a line chart when Year 2017 is selected.

2016.PNG

BR,

Vijay

I've included sample data file and QVF file.

Message was edited by: VIJAY VIRA

1 Solution

Accepted Solutions
felipedl
Partner - Specialist III
Partner - Specialist III

Hi,

What I observed is the following:

sample.png

I excluded the Dec month because it had some crazy numbers and distorted the graph.

Used the same expression as you, but with a modification on the oportunity record type.

Expression:

=

RangeSum

(

Above

(

Count

(

{<

[Opportunity Record Type]={'VO'},

[Launch Cal Year]={"$(=vGetSelectedYear)"}

>}

Distinct [Opportunity Id]

),

0,

RowNo()

),

AsOfMonth

)

This got me the result of the print.

Seems to be alright, according to your screenshots.

View solution in original post

7 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Vijay,

What's the output when you combine both graphs (one as bar and other as line)?

In my understanding, it should work ok since you have the month dimension on your graph.

I'm not able to open Sense apps right now, since i have on QV installed.

Could you share your load script for testing it on QV please?


Thanks,

Felipe.

vvira1316
Specialist II
Specialist II
Author

Hi Felip,

I've attached the script in text file.

Here is the sample of output chart (PN: line chart values are wrong)

NSS.PNG

Thanks,

Vijay

felipedl
Partner - Specialist III
Partner - Specialist III

Hi,

What I observed is the following:

sample.png

I excluded the Dec month because it had some crazy numbers and distorted the graph.

Used the same expression as you, but with a modification on the oportunity record type.

Expression:

=

RangeSum

(

Above

(

Count

(

{<

[Opportunity Record Type]={'VO'},

[Launch Cal Year]={"$(=vGetSelectedYear)"}

>}

Distinct [Opportunity Id]

),

0,

RowNo()

),

AsOfMonth

)

This got me the result of the print.

Seems to be alright, according to your screenshots.

vvira1316
Specialist II
Specialist II
Author

Hi Felip,

What is the expression for line? Is year check dynamic or hard coded? Can you please share your QVW file?

I think your line and bar numbers looks fine. Let me have the expression and file so I can check it out on my side.

Thanks,

Vijay

felipedl
Partner - Specialist III
Partner - Specialist III

Hi Vijay,

Everything is as you stated, the variables define the year and previous year and expression is same, with the opportunity code changed to the correspondent field value.

Expression for the line is also the same, only changing the variable set to the previous year.

Attached the QVW.

Hope it helps,


Felipe.

vvira1316
Specialist II
Specialist II
Author

HI Felip,

Thanks for sharing the QVW file. I see that you had little change in variable definition by including = sign. Vendor Opportunity to VO was data change for sharing the information here. The December data is skewed data for 2018 but it is working fine between 2017, 2016 and 2015.

I'm not sure why Qlik Sense behaves differently in combo chart. My expressions are working fine in line chart and bar chart respectively.

I tried it several time and it didn't work. Now all of sudden it stared working.

felipedl
Partner - Specialist III
Partner - Specialist III

Hi Vijay, can you mark the anwser that helped you as correct, so others on the community might find it to?

Felipe.