Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to display the previous 6 months and the next 5 months based on a selected month. Here is my data:
Year | Month | Quarter | Sales | CATEGORY |
2017 | January | 4 | 13000 | A |
2017 | February | 4 | 14000 | B |
2017 | March | 4 | 15000 | A |
2017 | April | 1 | 16000 | B |
2017 | May | 1 | 17000 | A |
2017 | June | 1 | 18000 | B |
2017 | July | 2 | 19000 | A |
2017 | August | 2 | 20000 | B |
2017 | September | 2 | 21000 | A |
2017 | October | 3 | 22000 | B |
2017 | November | 3 | 23000 | A |
2017 | December | 3 | 24000 | B |
2018 | January | 4 | 25000 | A |
2018 | February | 4 | 26000 | B |
2018 | March | 4 | 27000 | A |
2018 | April | 1 | 28000 | B |
2018 | May | 1 | 29000 | A |
2018 | June | 1 | 30000 | B |
2018 | July | 2 | 31000 | A |
2018 | August | 2 | 32000 | B |
2018 | September | 2 | 33000 | A |
2018 | October | 3 | 34000 | B |
2018 | November | 3 | 35000 | A |
2018 | December | 3 | 36000 | B |
e.g. I have selected YEAR=2018 and MONTH=MARCH, it should show me the selected month, the previous 6 months and the next 5 months like so:
Year | Month | Quarter | Sales | CATEGORY |
2017 | September | 2 | 21000 | A |
2017 | October | 3 | 22000 | B |
2017 | November | 3 | 23000 | A |
2017 | December | 3 | 24000 | B |
2018 | January | 4 | 25000 | A |
2018 | February | 4 | 26000 | B |
2018 | March | 4 | 27000 | A |
2018 | April | 1 | 28000 | B |
2018 | May | 1 | 29000 | A |
2018 | June | 1 | 30000 | B |
2018 | July | 2 | 31000 | A |
2018 | August | 2 | 32000 | B |
Thanks for any help.
Hi,
Try creating a field Period with YearMonth and select the range in set analysis.
Saludos.
Hi,
I already created a YearMonth by using this code:
Year&num(Month(Date#(Month,'MMM')),'00') as YearMonth
Now, i'm having troubles on how to add a months to it.
hello
why don't you add day 01 to your YearMonth date, so you can use qlik date functions ?
The result of my YearMonth is e.g. 201803, how do i add the day? thanks!
maybe
YearMonth*100+1