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: 
rammuthiah
Creator III
Creator III

Rolling 12 months count

In Graph, For ex month of today is August, then I need to show the project count from Next of current month(I mean from sep) to current month of Current year

My output should be : Current Month (08/2018)

9/201760
10/201720
11/201720
12/201730
1/201840
2/201850
3/201850
4/201860
5/201820
6/201840
7/201850
8/201850

Here below find the data :

  

YearMonthProjects
1/201720
2/201730
3/201740
4/201750
5/201760
6/201720
7/201740
8/201750
9/201760
10/201720
11/201720
12/201730
1/201840
2/201850
3/201850
4/201860
5/201820
6/201840
7/201850
8/201850
9/201860
10/201820
11/201820
12/201830
1/201940
2/201950
3/201950
4/201960
1 Solution

Accepted Solutions
OmarBenSalem

1) add a date field in ur table;:

load *, date(Date#('01'&'/'&YearMonth,'DD/M/YYYY')) as DateField Inline [

YearMonth, Projects

1/2017, 20

2/2017, 30

3/2017, 40

4/2017, 50

5/2017, 60

6/2017, 20

7/2017, 40

8/2017, 50

9/2017, 60

10/201,7 20

11/201,7 20

12/201,7 30

1/2018, 40

2/2018, 50

3/2018, 50

4/2018, 60

5/2018, 20

6/2018, 40

7/2018, 50

8/2018, 50

9/2018, 60

10/2018, 20

11/2018, 20

12/2018, 30

1/2019, 40

2/2019, 50

3/2019 ,50

4/2019, 60

];

2) use this expression:

sum({<YearMonth, DateField={">=$(=addmonths(today(1),-12))<=$(=today(1))"}>}Projects)


Result:

Capture.PNG

View solution in original post

1 Reply
OmarBenSalem

1) add a date field in ur table;:

load *, date(Date#('01'&'/'&YearMonth,'DD/M/YYYY')) as DateField Inline [

YearMonth, Projects

1/2017, 20

2/2017, 30

3/2017, 40

4/2017, 50

5/2017, 60

6/2017, 20

7/2017, 40

8/2017, 50

9/2017, 60

10/201,7 20

11/201,7 20

12/201,7 30

1/2018, 40

2/2018, 50

3/2018, 50

4/2018, 60

5/2018, 20

6/2018, 40

7/2018, 50

8/2018, 50

9/2018, 60

10/2018, 20

11/2018, 20

12/2018, 30

1/2019, 40

2/2019, 50

3/2019 ,50

4/2019, 60

];

2) use this expression:

sum({<YearMonth, DateField={">=$(=addmonths(today(1),-12))<=$(=today(1))"}>}Projects)


Result:

Capture.PNG