Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
has35526
Contributor III
Contributor III

To show data in set analysis beginning on the 7th of the month

Hi Everyone,

I have a requirement where I want to show measure beginning on the 7th of the month. For example: if user select a date or don't select the date between 1st and 10th (it could be any month). I only want to show data anything after 7th of the month.

Somehow the below measure is not working. 


Sum({<processing_date = {">=MonthStart(today())+6"}>} total_purchase + total_adjustment)

Labels (2)
1 Solution

Accepted Solutions
has35526
Contributor III
Contributor III
Author

Thanks Ruben for your help. Really appreciate it.

Here is my final set analysis incase if someone runs into the same scenario. 

if(GetSelectedCount(DateFieldName)=0,Sum({<DateFieldName= {">$(=date(Monthstart(Today())+6))"}>} Measurename), Sum({<DateFieldName= {">=$(=Date(MonthStart(Min(DateFieldName)+7,-1)))<$(=Date(MonthStart(Max(DateFieldName))))"}>} Measurename))

View solution in original post

6 Replies
rubenmarin

Hi, using today(), the reference date will be always the current date, not the selected date, also you should use $() to calculate the expression. And lastly the expression returned by the calculation has to be correctly interpreted, so better to use the DAte() function or to use a date field that is a number.

In example, if you want to use the max date selected as reference it could be:

Sum({<processing_date = {">=$(=Date(Max(DateFieldName)+6))"}>} total_purchase + total_adjustment)

has35526
Contributor III
Contributor III
Author

Hi Ruben,

When I select a date the results are always for the next month.  For example if I select April I am getting the data for May. Any idea why this is happening?

has35526
Contributor III
Contributor III
Author

For the previous question requirement change so I was able to get it working using the below set analysis 

Sum({<processing_date = {">$(=date(Monthstart(Today())+6))"}>} total_purchase + total_adjustment - total_refund)

I have another requirement what ever month user select I want to show previous month data. Please let me know how this can be achieve.  

rubenmarin

Hi, if you select just may the max date will be the 31st of may, and adding 6 days y goes to juny. You can try with Min instead of Max.

rubenmarin

Sum({<processing_date = {">=$(=Date(MonthStart(Max(DateFieldName),-1)))<$(=Date(MonthStart(Max(DateFieldName))))"}>} total_purchase + total_adjustment)

has35526
Contributor III
Contributor III
Author

Thanks Ruben for your help. Really appreciate it.

Here is my final set analysis incase if someone runs into the same scenario. 

if(GetSelectedCount(DateFieldName)=0,Sum({<DateFieldName= {">$(=date(Monthstart(Today())+6))"}>} Measurename), Sum({<DateFieldName= {">=$(=Date(MonthStart(Min(DateFieldName)+7,-1)))<$(=Date(MonthStart(Max(DateFieldName))))"}>} Measurename))