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

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)])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
asinghal0412
Partner - Creator
Partner - Creator
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?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
asinghal0412
Partner - Creator
Partner - Creator
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
Please close the thread by marking correct answer & give likes if you like the post.