Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello all ,i was going through few of our community posts ,where i found this statement ,please can anyone explain me how does it works and the agenda for this statment thank you
Sum(if(InYearToDate([Invoice Date], MakeDate($(=Max(InvoiceYear)), Month(Today()), Day(Today())), 0), Sales))
This statement is just checking if invoice date comes under the max year's today's day and month, then sum sales.
For example if you have data like this:
Invoice Date | Invoice Year | Sales |
---|---|---|
02/03/2015 | 2015 | 20 |
05/07/2015 | 2015 | 30 |
10/10/2014 | 2014 | 10 |
12/30/2015 | 2015 | 20 |
The InYeartoDate will evaluate like this (Max(Invoice Year) = 2015
Invoice Date | InYearToDate([Invoice Date], MakeDate($(=Max(InvoiceYear)), Month(Today()), Day(Today())), 0) |
---|---|
02/03/2015 | -1 (True) |
05/07/2015 | -1 (True) |
10/10/2015 | 0 (False) |
12/30/2015 | 0 (False) |
So the
Sum(If(InYearToDate([Invoice Date], MakeDate($(=Max(InvoiceYear)), Month(Today()), Day(Today())), 0), Sales) = 50
I hope this helps. To learn about InYearToDate() function see the below screenshot from QlikView's help page: