If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
Hi,
I have a requirement to show data for a period from last month of 15 date to current month of 16 date for a table in qliksense
#setanalysis #Qliksense
Hi Flyhigh,
I solved this by creating some variables that gets me the dates i want and them using them as a parameter in the Set Analysis.
check the code below:
//Get the year from last month (Case it's on january it will not break)
LET vYearLastMonth = Year(AddMonths(Today(),-1));
//Get Current Year
LET vYear = Year(Today());
//Concatenate the day (Fixed Value) with the month number from last month and concatenating the year, thus we have 15/08/2022.
LET vPastMonth = '15/' & RIGHT(0 & Num(Month(AddMonths(Today(),-1))),2) & '/' & $(vYearLastMonth);
//Concatenate the day (Fixed Value) with the month number from Current month and concatenating the year, thus we have 16/09/2022.
LET vCurrentMonth = '16/' & RIGHT(0 & Num(Month(Today())),2) & '/' & $(vYear);
//On your Expression use:
COUNT({<YourDateField = {">$(vPastMonth) < $(vCurrentMonth)"}>} YourField)
Just change the fields on the expression.
Let me know if it works.
@flyhigh15 I have used the below expression:
Sum({<OrderDate={">=$(=Date(Monthstart(Addmonths(Today(),-1))+14,'MM/DD/YYYY'))<$(=Date(Monthend(Addmonths(Today(),-1))-14,'MM/DD/YYYY'))"}>}LineSalesAmount)
Please let me know if this worked for you.
If yes,please like and accept it as a solution.