Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
RobinB1
Contributor
Contributor

Set analysis: forecst where YearMonth > year(today())&month(today())

Hi,

New to qlikview,

I have a field named YearMonth. It's set up so that months jan - sep have a zero before their number, so we have e.g. 202109, 202110...

I've been working on a dynamic expression that would return consumption forecast data where YearMonth is larger than the year&month of today's date.

For example, this one returns data for months 5-12 for all year in scope:

=Sum({<Month={'>$(=Num(Month(Today())))'},>}kWh)/Volume

This one returns data for all months and all years in scope:

=Sum({<Month={'>$(=Month(Today()))'},>}kWh)/Volume

Not sure why. My understanding is that stuff quoted with single quote signs allows us to use QV built-in functions, i.e. the below is not doable since the platform does not include a YearMonth function?

=Sum({<YearMonth={'>$(YearMonth(Today(),"YYYYMMDD"))'},>}kWh)/Volume

I guess set expression modelling fundamentally differs, but borrowing some excel syntax, I'm looking for:

=Sum({<YearMonth={'>$(=Year(Today())&IF(Len(Month(Today()))=1;”0”&Month(Today());Month(today())))'},>}kWh)/Volume

 

Cheers,

Robin

1 Solution

Accepted Solutions
jwjackso
Specialist III
Specialist III

Try Sum({<YearMonth={">$(=Date (Today (1),'YYYYMM'))"}>}kWh)/Volume

 

The Date(Today(1),'YYYYMM") should return YearMonth like 202110

View solution in original post

2 Replies
jwjackso
Specialist III
Specialist III

Try Sum({<YearMonth={">$(=Date (Today (1),'YYYYMM'))"}>}kWh)/Volume

 

The Date(Today(1),'YYYYMM") should return YearMonth like 202110

RobinB1
Contributor
Contributor
Author

Thanks, did the trick!