Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
ramanannad
New Contributor III

Cumulative Line Snapshot

Dear Experts, 

We managed a cumulative line chart having month as dimension with two growing % of actual and %plan progress. The charts works perfect with rangesum function but users request is to have the chart keep the full value even when a particular month range is filtered. By default, the rangesum recalculates the values based on selection and this makes the figures go wrong. What is required is just a snapshot/zoomed view of the original chart(without any selections).

Dimension: Universal.MonthYear

Measure1(Plan):

IF(if(Sum( {$<DateType={'Plan'}>} [Plan Weightage])=0,null(),Sum( {$<DateType={'Plan'}>} [Plan Weightage])) = 0, 0,
rangesum(above(if(Sum( {$<DateType={'Plan'}>} [Plan Weightage])=0,null(),Sum( {$<DateType={'Plan'}>} [Plan Weightage])),0,rowno()))/
(Sum ( total {$<DateType={'Plan'}>} [Plan Weightage])))

Measure2(Actual):

if(Universal.MonthYear < date(max(Uni_Act_Date),'YYYY-MM-DD hh:mm:ss.fff'),

IF(if(Sum( {$<DateType={'Actual'} >} [Actual Weightage])=0,null(),
Sum( {$<DateType={'Actual'}>} [Actual Weightage])) = 0, 0,

rangesum(above(if(Sum( {$<DateType={'Actual'}>} [Actual Weightage])=0,null(),
Sum( {$<DateType={'Actual'}>} [Actual Weightage])),0,
rowno()))/(Sum ( total {$<DateType={'Plan'}>} [Plan Weightage]))))

Base:

Base.png

Month selected:

Selected.png

*Feb values has changed based on the selection, requirement is to have it locked at original values as the next image:

 

Expected

Expected.png

*Edited in MS Paint

The primary table and data model has many fields thus we are trying to achieve this in front end rather back in load script. Hope this explains the issue in hand 🙂 How do we solve this using front end expressions?

 

Thanks

Ram

1 Solution

Accepted Solutions

Re: Cumulative Line Snapshot

Try these expressions and see if they work

If(If(Sum({$<DateType = {'Plan'}>} [Plan Weightage]) = 0, Null(), Sum({$<DateType = {'Plan'}>} [Plan Weightage])) = 0, 0,
RangeSum(Above(If(Sum({$<DateType = {'Plan'}, [Universal.MonthYear]>} [Plan Weightage]) = 0, Null(), Sum({$<DateType = {'Plan'}, [Universal.MonthYear]>} [Plan Weightage])), 0, RowNo()))/(Sum(TOTAL {$<DateType = {'Plan'}>} [Plan Weightage])))

and

If(Universal.MonthYear < Max(Uni_Act_Date),
If(If(Sum({$<DateType = {'Actual'}>} [Actual Weightage]) = 0, Null(),
Sum({$<DateType = {'Actual'}>} [Actual Weightage])) = 0, 0,

RangeSum(Above(If(Sum({$<DateType = {'Actual'}, [Universal.MonthYear]>} [Actual Weightage]) = 0, Null(),
Sum({$<DateType = {'Actual'}, [Universal.MonthYear]>} [Actual Weightage])), 0, 
RowNo()))/(Sum(TOTAL {$<DateType = {'Plan'}>} [Plan Weightage]))))

View solution in original post

2 Replies

Re: Cumulative Line Snapshot

Try these expressions and see if they work

If(If(Sum({$<DateType = {'Plan'}>} [Plan Weightage]) = 0, Null(), Sum({$<DateType = {'Plan'}>} [Plan Weightage])) = 0, 0,
RangeSum(Above(If(Sum({$<DateType = {'Plan'}, [Universal.MonthYear]>} [Plan Weightage]) = 0, Null(), Sum({$<DateType = {'Plan'}, [Universal.MonthYear]>} [Plan Weightage])), 0, RowNo()))/(Sum(TOTAL {$<DateType = {'Plan'}>} [Plan Weightage])))

and

If(Universal.MonthYear < Max(Uni_Act_Date),
If(If(Sum({$<DateType = {'Actual'}>} [Actual Weightage]) = 0, Null(),
Sum({$<DateType = {'Actual'}>} [Actual Weightage])) = 0, 0,

RangeSum(Above(If(Sum({$<DateType = {'Actual'}, [Universal.MonthYear]>} [Actual Weightage]) = 0, Null(),
Sum({$<DateType = {'Actual'}, [Universal.MonthYear]>} [Actual Weightage])), 0, 
RowNo()))/(Sum(TOTAL {$<DateType = {'Plan'}>} [Plan Weightage]))))

View solution in original post

Highlighted
ramanannad
New Contributor III

Re: Cumulative Line Snapshot

Thanks alot Sunny !!

I tried your suggestion earlier and it dint work by itself but your suggestion triggered another idea and I manage to resolve this with the following expression:

if(Universal.MonthYear< date(max(total Uni_Act_Date),'YYYY-MM-DD hh:mm:ss.fff'),

IF(if(Sum( {$<DateType={'Plan'}>} [Plan Weightage])=0,null(),Sum( {$<DateType={'Plan'}>} [Plan Weightage])) = 0, 0,
rangesum(above(if(Sum( {$<DateType={'Plan'},[Universal.MonthYear]>} [Plan Weightage])=0,null(),Sum( {$<DateType={'Plan'},[Universal.MonthYear]>} [Plan Weightage])),0,rowno()))/(Sum ( total {$<DateType={'Plan'},[Universal.MonthYear]>} [Plan Weightage]))
))

 Thanks alot for your assistance 🙂

Ram