Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Don't miss the upcoming Q&A with Qlik session on Qlik Application Automation on November 16th! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
asinghal0412
Partner
Partner

How to set the Calendar year to current year using set analysis

Dear Qlik Community,

I have a code below:

if([Calendar Year] = year(today()),

if([Calendar Year/Month]<today(),

[NET VAVE (Actual)],

[NET VAVE (Forecast)]))

The above code gives the solution for the current year but also returns the previous year's values as empty in the pivot chart. 

I want to write a set analysis where I can set the calendar year to the current year.

Can anyone here help me with this?

Best,

A.S

Labels (1)
5 Replies
Anil_Babu_Samineni

Make sure the format firstly? otherwise below one give some hit to start-up

Sum({<[Calendar Year] ={"=[Calendar Year] <=Year(Today())"}>} [NET VAVE (Actual)])

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
asinghal0412
Partner
Partner
Author

Dear Anil,

Thanks for the response, but if you will check the statements above, it will include the If clause as well, can you implement it in your code?

Thanks,

Akash

Anil_Babu_Samineni

May be explain with sample data?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
asinghal0412
Partner
Partner
Author

i dont think we need a sample data, It is a straight forward data and the formula.

MayilVahanan

HI @asinghal0412 

Try like below 

Instead of [Calendar Year/Month], try with ur calendar date field

Sum({<[Calendar Year] ={"$(=Year(Today()))"},DateField = {"<=$(=Date(Today(),'YourDateFormat'))"}>} [NET VAVE (Actual)])

+

Sum({<[Calendar Year] ={"$(=Year(Today()))"},DateField = {">$(=Date(Today(),'YourDateFormat'))"}>} [NET VAVE (Forecast)])

Thanks & Regards,
Mayil Vahanan R