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: 
ramanannad
Contributor III
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

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

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
sunny_talwar

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]))))
ramanannad
Contributor III
Contributor III
Author

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