Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Raval
Contributor II
Contributor II

RangeSum() with Line chart in QLik Sense.

Hello Experts,

I have data since 2021 in my model.
I have to create Line Chart by MOnth/Year, the expression of Chart is as based on Running sum of last 12 months as per below.

((sum({<DESCRIPTION=,PARTNO=>} [FA_QTY_FUNC] * [AVERAGE_PRICE])
/
Rangesum(Above( Sum({<DESCRIPTION=,PARTNO=>}CONSUME_AVG_PRICE_FUNC),0,12)))
)*365

 

now as we have data from 2021 for whole 2021 our expression will not calculate correct running sum of last 12 months. so we want our graph shows only month onwards Jan-2022. 

As soon as i am trying to do so my RangeSum() is considering Jan2022 as First month starts summing value from Jan2022 only. and my calculation starts showing wrong data as per functional requirement.

Can we have some expression which will give us last 12 month SUM even if we are showing it in Dimension.

 

Thanks in advance.

 

Raval_0-1714134457018.png

 

 

 

 

 

Labels (1)
1 Reply
F_B
Specialist
Specialist

Hi @Raval ,

try if this works:

(
sum(
{
<DESCRIPTION=, PARTNO=>,
MonthYear={">=$(=MonthStart(Max(MonthYear), -11))<=$(=MonthEnd(Max(MonthYear)))"}
}
[FA_QTY_FUNC] * [AVERAGE_PRICE]
)
/
Rangesum(
Above(
Sum(
{<DESCRIPTION=, PARTNO=>
, MonthYear={">=$(=MonthStart(Max(MonthYear), -11))<=$(=MonthEnd(Max(MonthYear)))"}
}
CONSUME_AVG_PRICE_FUNC
)
,0,12
)
)
) * 365