Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
maudifer
Contributor III
Contributor III

Variables and straight table calculation

Hi All,

I have built the below straight table and variables. I am doing sums based on months or month averages.

I need to be able to change the Current month variable each month and have the calculate each column automatically.

The issue i am having is that it only works if the CurrentMonth variable is 12 (December). If i use any other month, it bugs because we are overlapping 2 different years.  Can some help me with this ?

qilk view capture.JPGCapture Qlik view variables.JPG

3 Replies
sunny_talwar

Would you be able to share a sample which shows the issue?

maudifer
Contributor III
Contributor III
Author

Hi Sunny,

see below, when i change the current month and year, it does not work.

I first created this to report on Dec 17 and the below example i tried to report on Jan 18

but it seems to not work when I do that . It won't calculate anymore and it also does not know that the month before Month 1 of 2018 is month 12 of 2017

Do you know how I could set the variables to it knows what the previous month is even if it a different year ?

Thanks

Capture FCl teu with issue.JPG

settu_periasamy
Master III
Master III

May be try this

vpreviousmonth1

=Month(AddMonths(makeDate(2018,$(vCurrentmonth),1),-1))

vpreviousmonth2 :


=Month(AddMonths(makeDate(2018,$(vCurrentmonth),1),-2))