Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a bar chart consists of two bars for current month and previous month. The filter pane contains list of month-year like below table. The need is to change the bar graph as per the selection in filter pane. For example, if I select Oct-2019, chart shows Oct-2019 and Sep-2019. if June-2019, then June -2019 and May 2019 and so on. Kindly assist.
Month-Year | Sales |
Jan-2018 | 1000 |
Feb-2018 | 2000 |
Mar-2018 | 3000 |
Apr-2018 | 4000 |
May-2018 | 5000 |
Jun-2018 | 6000 |
Jul-2018 | 7000 |
Aug-2018 | 8000 |
Sep-2018 | 9000 |
Oct-2018 | 10000 |
Nov-2018 | 11000 |
Dec-2018 | 12000 |
Howdy Umesh!
I like to build my calendars with an SortID attached to each major dimension that is text based or non-numeric (Month-Year, MonthName, DayOfWeek) [NOTE: If you've kept these numeric or used a dual() or some other sort of sorting system you can skip step 1 and go straight to step 2].
Step 1:
Month-Year2:
Load Month-Year
Resident Calendar
Order by Date Descending;
Left Join (Calendar) // BECAREFUL - FOR WHATEVER REASON SOME VERSIONS OF QLIK WILL DISTINCT THE LEFT TABLE AS WELL, IF THIS HAPPENS SIMPLY DISTINCT THIS TABLE WITHOUT THE LEFT JOIN AND THEN LEFT JOIN IN A 3 STEP.
Load Distinct Month-Year
RowNo() as Month-Year_ID
Resident Month-Year2;
Drop Table Month-Year2;
Step 2:
Now in your chart you can use this equation:
Sum({1<[Month-Year_Sort] = {">=$(=(min([Month-Year_Sort])-1))<=$(=(min([Month-Year_Sort])))"}>}Sales)
The 1 gives us global data while the min[Month-Year_Sort]-1 gives you 1 month-year behind and the last min[Month-Year_Sort] gives you the cap which is your selection.
Hope this helps!
Kind regards,
Yogi Achilleos
there are many ways to solve this issue, see attached gif animation and attached qvf for a way to do it.