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

Greater then today's Year-Month

Hi All,

I have an expression where i want to present future months.

this table is brings seasonal Data ( sep-2014 to sep-2015).

I'm trying to find a way to calculate values only if their Year-Month is equal or greater then today's year month.

appreciate any help

Avner

5 Replies
Anonymous
Not applicable
Author

Hi,

Best solution is to create a flag in script and then use it in the experssion.

In scrip->>

LOAD *, if(monthname(today())>=yourmonthnamefield, 1,0) as FlagFuture;

LOAD*, monthname(yourdatefield) as yourmonthnamefield

FROM yoursource;

In expression->>

=sum({<FlagFuture={'1'}>} yourvaluefield)

Hope it helps.

Marc.

Anonymous
Not applicable
Author

Hi Marc

thanks for your help, i used your syntax but added MonthStart, because i need the full date format.

if(Date>=MonthStart(today()),1,0) as Future_Flag

cheers

avner

Anonymous
Not applicable
Author

Avner,

Actually you will get the same result, because Monthname function returns the same numeric value than Monthstart function.

Marc.

Anonymous
Not applicable
Author

That's right,

but I was afraid to lose the connection between the month and the year.

Anonymous
Not applicable
Author

Avner,

You will only loose the connection between year and month with the Month() function, that returns only the month and not the year.

Use Monthname or Monthstart as your election, the difference is the format of result date, but not the internal numeric value.

Marc.