Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
shahzad
Contributor II
Contributor II

Cumulative Trend in Line Chart including last year values

Dears

I want to calculate Cumulative line chart. The requirement is as below:

Lets say there is 6 years of data (2021,2022,2023,2024,2025 and 2026(until today))

Dimension as "Month" and measure should show Current year + "Last all year data in Jan"

Scenario 1:  Suppose I have 1000 records from Jan 2021 until Dec 2025, and Jan-2026  has 5 , Feb-2026 Have 9, Mar-2026 have 6 and so on.

So the expression should show :

Jan =1005

Feb =1014

Mar =1020

and so on.

Scenario 2: Suppose user selects last Year(2025) from the filter.

So the expression should be:

Jan 2025 as (Jan 2025 + All previous records until Dec 2024)

Feb 2025 as Feb 2025 + Jan 2025 + All previous records until Dec 2024

 

Best Regards

Shahzad

Labels (1)
1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

Hi try this 

Dim :month 

Measure:

Sum(
{
<
Year = {"<$(=Max(Year))"}
>
}
Amount
)
+
RangeSum(
Above(
Sum(
{
<
Year = {"$(=Max(Year))"}
>
}
Amount
),
0,
RowNo()
)
)

View solution in original post

3 Replies
Chanty4u
MVP
MVP

Hi try this 

Dim :month 

Measure:

Sum(
{
<
Year = {"<$(=Max(Year))"}
>
}
Amount
)
+
RangeSum(
Above(
Sum(
{
<
Year = {"$(=Max(Year))"}
>
}
Amount
),
0,
RowNo()
)
)

shahzad
Contributor II
Contributor II
Author

Hi

Many Thanks.

It worked with slight Change. I added "Total" for the past year expression.

 

Sum(total
{
<
Year = {"<$(=Max(Year))"}
>
}
Amount
)
+
RangeSum(
Above(
Sum(
{
<
Year = {"$(=Max(Year))"}
>
}
Amount
),
0,
RowNo()
)
)

 

BR

Shahzad

Chanty4u
MVP
MVP

Glad it worked !