Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
sculptorlv
Creator III
Creator III

How to get data from period - this month

Hello! Hope for your help again.

I have columns "Posting_date" and "Sales".

How can I get all "Sales" values from current month?

                        

I need to replace IF value "Bouth__PostingDate > Today()- 15" in the following sentence :

= SUM(   IF(PostingDate > Today()- 15, Sales, 0) )

Because - 15 is ok only, if we have 15.12.2015 date today. How can I make it ok for all TODAY dates?

Thank you in advance.

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

A simple correction to your statement:

Sum(If(PostingDate >= MonthStart(Today()), Sales, 0)


Converted to set analysis:

Sum({<PostingDate = {">=MonthStart(Today())"}>} Sales)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

12 Replies
Anonymous
Not applicable

try like this:

=SUM({<PostingDate=,PostingDate={'>=$(=date(monthstart(max(PostingDate)),'YourDateFormat')<=$(=date(max(PostingDate),'YourDateFormat')'} >} Sales)

where 'YourDateFormat' like ='DD/MMM/YYYY'

also make sure PostingDate & 'YourDateFormat' format should be same

Anonymous
Not applicable

If you want to do for Max date only i.e today only, then try like this:

=SUM({<PostingDate=,PostingDate={'$(=date(max(PostingDate),'YourDateFormat')'} >} Sales)

where 'YourDateFormat' like ='DD/MMM/YYYY'

also make sure PostingDate & 'YourDateFormat' format should be same

Anonymous
Not applicable

check this for more details:

Set Analysis for certain Point in Time

sculptorlv
Creator III
Creator III
Author

Something wrong this the syntax in this Date format, can you check please?

111.jpg

jonathandienst
Partner - Champion III
Partner - Champion III

A simple correction to your statement:

Sum(If(PostingDate >= MonthStart(Today()), Sales, 0)


Converted to set analysis:

Sum({<PostingDate = {">=MonthStart(Today())"}>} Sales)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sculptorlv
Creator III
Creator III
Author

Thank you!

I really was looking for this function MonthStart

Anonymous
Not applicable

Could you share your expression?

sculptorlv
Creator III
Creator III
Author

=SUM({<Bouth__PostingDate=,Bouth__PostingDate={'>=$(=date(monthstart(max(PostingDate)),'YourDateFormat')<=$(=date(max(PostingDate),'YourDateFormat')'} >}  Bouth_Cofee_Item_Money)

sculptorlv
Creator III
Creator III
Author

Is there opposite function to Addmonths?

___months(Date,1) = Date - 1 month