Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I'm new to Qlik Sense. Anyone knows the Expression Formula for 'current month' vs. 'last month'? I have an example table below.
Channel | Sessions | Month | Year | MonthYear |
Paid Search | 837 | May | 2014 | May 2014 |
Organic Search | 860 | May | 2014 | May 2014 |
Organic Search | 728 | June | 2014 | June 2014 |
Paid Search | 805 | June | 2014 | June 2014 |
Organic Search | 173 | July | 2014 | July 2014 |
Paid Search | 266 | July | 2014 | July 2014 |
Organic Search | 114 | April | 2015 | April 2015 |
Paid Search | 728 | April | 2015 | April 2015 |
Organic Search | 111 | May | 2015 | May 2015 |
Paid Search | 583 | May | 2015 | May 2015 |
From the table, for example, I want to get the sessions for May 2015 vs. April 2015 for each channel in a table format. Also, to get the sessions for May 2015 vs. May 2014. So the output would be.
Sessions
Channel | May 2015 | April 2015 |
Organic Search | ||
Paid Search |
Sessions
Channel | May 2015 | May 2014 |
Organic Search | ||
Paid Search |
Thanks a lot for your help.
Hi,
For each output you have to use a pivot table with
Line : Channel
Measures : 2 set analysis expressions (1 for each column)
To make the set analysis easier i suggest to add a field "MonthNumber" in your table. You can make this with an expression or with a mapping table in the script.
Current Year - Current Month vs Previous Month
1st measure should look like : Min({<MonthNumber={$(=month(today())+0)},Year={$(=year(today()))}>} Sessions)
2nd : Min({<MonthNumber={$(=month(today())-1)},Year={$(=year(today()))}>} Sessions)
Current Year-Month vs Previous Year-Month
1st measure should look like : Min({<MonthNumber={$(=month(today())+0)},Year={$(=year(today()))}>} Sessions)
2nd : Min({<MonthNumber={$(=month(today())+0)},Year={$(=year(today())-1)}>} Sessions)
NB : the +0 is important for convert text to number.