Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
nlee1993
Contributor III
Contributor III

Line chart measure dependent on dimension

Hi Qlik Community,


I have created a line chart, with dates on the x-axis and a rangesum for a stock level on the y-axis. The stock is the sum of the stock since "the beginning of time" (2007 ish in my case), however I only want to show on my chart 2015 onwards. When I filter to show only 2015 onwards, the measure recalculates the sum since the new beginning of time (my 2015 filter) and the values change. 

Does any one know how to de-couple the measure from the dimension, in a way that will preserve a range sum since the beginning of the data set, when filtering my dimension?

chrome_2019-01-30_09-12-48.pngchrome_2019-01-30_09-13-25.pngchrome_2019-01-30_09-13-40.pngchrome_2019-01-30_09-13-57.png

 

Labels (7)
16 Replies
pradosh_thakur
Master II
Master II

try multiplying the EXPRESION WITH

avg({<Year={2015,2016,2017,2018}>}1) // you can changes your field accordingly

 

Edit: Please don't make the year static and use some expression to make this dynamic. 

Learning never stops.
OmarBenSalem

change ur Measure from:

Rangesum(Above(

sum(In-Out)

,0,rowno()))

 

to :

Aggr( {<YourDateDimension>}

Rangesum(Above(

sum(In-Out)

,0,rowno()))

,YourDateDimension)

 

Result per analogy:

With no selection:

Capture.PNG

Now I select from week 35 (128.88M)Capture.PNG

 

 Capture.PNG

If u want to ONLY SELECT WEEK 35 and get all the data since 35:

sum({<YourDateDimension={">=$(=min(YourDateDimension))"}>}aggr({<YourDateDimension>}
RangeSum(above(
Sum({<YourDateDimension>}In-Out)
,0,RowNo()))
,YourDateDimension))

Capture.PNGCapture.PNG

OmarBenSalem

It's never a good idea to build static expressions Pradosh

pradosh_thakur
Master II
Master II

I understand Omar. What i suggested is to use avg(1) with the set expession. I was not sure about the field used as dimension so made the values static.

I guess the OP wants the number to not start from zero from the year he wanted hence the solution.
Learning never stops.
OmarBenSalem

Please see my reply, I think that's what he wants to achieve.

nlee1993
Contributor III
Contributor III
Author

Hi OmarBenSalem,

Thank you for your contribution. I applied your solution as follows and experienced a strange effect on my graph. Do you know how to resolve this? I have a feeling it may be something to do with the Aggr function?

 

chrome_2019-01-30_10-09-40.pngchrome_2019-01-30_10-10-01.png

OmarBenSalem

Can u please uncheck continous axis under the x-axis tab and select only the last month u have so that we could see what had happened?

nlee1993
Contributor III
Contributor III
Author

I have a day by day axis so I am looking to show the continuous aspect in my chart, however I have filtered to just one month, January 2017, to check it out. It seems this aggregation is increasing the raw data values markedly (see screenshot) as no data points in this month reach 1.7m, so I think perhaps I'm basing it incorrectly

chrome_2019-01-30_10-18-53.png

OmarBenSalem

Reattach the same image with data points checked with the values (under presentation tab)

and add a new line chart with ur basic measure:

sum(In-Out)

I want to compare the 2 to see what the rangesum does