Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Ajaymehta
Contributor
Contributor

Combine 3 months data and represent in pivot table monthly

We have data from Jan 2020 to Jan 2022  

And wanted to show this into pivot table by combining previous 3 months data to each month. example are attached in picture format

Labels (4)
1 Reply
RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @Ajaymehta 

try this

with this data

load 
year(Period) as Year,
month(Period) as Month,
sales
inline [
Period, sales
1/1/2021,10
2/1/2021,10
3/1/2021,10
4/1/2021,10
5/1/2021,10
6/1/2021,10
7/1/2021,10
8/1/2021,10
9/1/2021,10
10/1/2021,10
11/1/2021,10
12/1/2021,10
1/1/2022,20
2/1/2022,20
3/1/2022,20
4/1/2022,20
5/1/2022,20
6/1/2022,20
7/1/2022,20
8/1/2022,20
9/1/2022,20
10/1/2022,20
11/1/2022,20
12/1/2022,20
1/1/2023,30
2/1/2023,30
3/1/2023,30
4/1/2023,30
5/1/2023,30
6/1/2023,30];

in a pivot table

Dimension: Year

Column: Month

Measure: RangeSum(Before(sum(sales), 0, ColumnNo()))

RafaelBarrios_0-1688065572575.png

or in a table o char you can use

Measure: rangesum(above(sum(sales),0,12))

or the measure modifier option

RafaelBarrios_1-1688065716659.png

 

hope it helps

help users find answers! Don't forget to mark a solution that worked for you & to smash the like button!