Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
flyhigh15
Contributor III
Contributor III

Set analysis Period of dates data in a table

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

2 Replies
Zapparoli
Creator II
Creator II

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. 

Check my Youtube Channel for more Qlik Content
https://www.youtube.com/@ZappaAnalytics

sidhiq91
Specialist II
Specialist II

@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.