Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

hopkinsc
Valued Contributor

Help with Line Chart

Hi all,

i need some help getting a line chart to work as needed.

I have a dimension of LeadTime (1-10) and a measure of Sum(Sales), i need it to be accumulated, so i am using the RangeSum function. so my full measure is..

RangeSum(

Below(

Sum({$<LeadTime={"<=$(vLeadTime)"}>}

Sales),

0,

NoOfRows())) !

what i want is for the measure to remain the same when a user selects a lead time. so currently, if i dont select a lead time, my chart goes to 1.6k. if i then select a lead time of 5, the chart changes to show around 750. i still want to see the 1.6k but i just want the dimension values to change to only show 0-5.

so basically i just want the chart to zoom in on the selections but still see the original value.

does that make sense?

i have attached a sample QVF.

1 Solution

Accepted Solutions
MVP
MVP

Re: Help with Line Chart

Try this

RangeSum(

Below(

Sum({<LeadTime>}Sales),

0,

NoOfRows()))

* Avg({$<LeadTime={"<=$(vLeadTime)"}>}1)

7 Replies
MVP
MVP

Re: Help with Line Chart

Try this

RangeSum(

Below(

Sum({<LeadTime>}Sales),

0,

NoOfRows()))

* Avg({$<LeadTime={"<=$(vLeadTime)"}>}1)

hopkinsc
Valued Contributor

Re: Help with Line Chart

Hi Sunny,

thanks very much, is there a way to hide the unwanted dimension values?

MVP
MVP

Re: Help with Line Chart

Uncheck 'Include zero values' under Add-ons -> Data handling

hopkinsc
Valued Contributor

Re: Help with Line Chart

thanks for your help once again

alip_ptc
New Contributor

Re: Help with Line Chart

Bit unrelated but curious to know what '* Avg({$<LeadTime={"<=$(vLeadTime)"}>}1)' this part of the function doing?

MVP
MVP

Re: Help with Line Chart

Since we are ignoring selection in LeadTime field in the main expression so that we can have accumulation beginning from the start rather than restarting it based on the selection. We somehow need to remove the data which is not true based on the set analysis. By using this expression, we are saying that where ever the set analysis condition is true, we will have 1, else 0. So, essentially, we are zeroing out the unwanted data to just show the line for LeadTime greater than selected LeadTime.

Does it make sense?

alip_ptc
New Contributor

Re: Help with Line Chart

yeah understood more clearly when tried it myself!

Nice trick.