Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Today,YTD and MTD in Qlikview Script

Dear All,

Can any one give me Idea to find the Vaue for Today,YTD and MTD in the Qlikview Script.

Thanks In Advance !!

Regards

Deepak

10 Replies
joshabbott
Creator III
Creator III

Today: if(Date = Today(), True, False) as TodayDate

YTD: if(Date <= Today() and Year(Date) = Year(Today()), True, False) as YTD

MTD: if(Date <= Today() and Year(Date) = Year(Today()) and Month(Date) = Month(Today()),True, False) as MTD

Where Date is the date in your script.

buzzy996
Master II
Master II

You can try:

YTD:

=num(sum({$<Year = {$(=only(Year))}, Month = {"<=$(=max(Month))"}>} LineSalesAmount), '$#,##0;($#,##0)')

QTD:

=num(sum({$<Year = {$(=only(Year))}, Quarter = {$(=only(Quarter))}, Month = {"<=$(=max(Month))"}>} LineSalesAmount), '$#,##0;($#,##0)')

MTD:

=num(sum({$} LineSalesAmount), '$#,##0;($#,##0)')

GL

beunderf
Partner - Creator II
Partner - Creator II

What do you want to achieve with these values?

Not applicable
Author

Hi Shiva,

I want in this Qlikview Script.

Not applicable
Author

Hi Frank,

This is the requirement .

Not applicable
Author

Hi Josh,

Thanks for reply. Yes Date is the Transaction Date in this Script

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Look at Help for functions:

InYearToDate()

InMonthToDate()

-Rob

http://masterssummit.com

http://robwunderlich.com

beunderf
Partner - Creator II
Partner - Creator II

Do you want to calculate these values in your load script? You want to have a fixed YTD value in a table?