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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mimivan
Contributor II
Contributor II

Dynamic column as previous 6 months with data from a table

I have loaded data in a table below and every month user need to create a visualization of past 3 months  data.  How can I create column heading as month ? Thank you.

Data:

Key Year Month Value
A 2022 8 1
A 2022 10 2
A 2022 12 3
A 2023 1 14
A 2022 5 1
A 2022 6 1
B 2023 1 6
B 2022 10 8
B 2022 11 19


Output Table when view in Feb, 2023:

          Nov           Dec             Jan

A                            3                  14
B          19                                    6


Output Table when view in Jan ,2023:

             Oct          Nov           Dec
A          2                                    3
B          8                19

Labels (1)
2 Replies
Sabrina_V
Partner - Creator II
Partner - Creator II

The calcul are dynamic regarding the selections made by the user ? If yes, you can create a expression with a set analysis : FieldDate = {">= AddMonths($(=Max(Your date)),-3) <= $(=Max(Your date))"}

379SSS
Contributor III
Contributor III

OfCourse you can achieve using pivot table by adding month filed in column and key filed in row values in Measure 

to get latest three month data you can use


Sum({<Date= {"$(='>=' & Date(AddMonths(Max(Date), -3)) & '<' & Date(Max(Date)))"}>} Value)