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

Expression not working

Hello, 

I have a table as shown below
1.PNG

 

 

 

 

 

I am calculating Current - Dec = (Current Month POC - Last Year December month POC)

Eg: for January-2018, 28.30-19.90 = 8.4, for February-2018, 39.40-19.90 = 19.5.

But My Values are wrong as highlighted in the above image. 

What is wrong with my expression here? Attached is the file for reference

Sum(POC)
-
Sum({<Num_Month = {'$(vPreYearLastMonth)'},Year = {'$(vPreYear)'}>}POC)

thanks

Bhavesh

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

Try this

Sum(POC) - Above(TOTAL Sum(POC), Num(Month))

I think your values for Jan, Feb, Mar are not right.... they should be 0, 0, and 0, right because you have 100-100 for all three months of 2018

View solution in original post

13 Replies
sunny_talwar

Try this

Sum(POC)
-
Above(TOTAL Sum(POC))
pradosh_thakur
Master II
Master II

I think below will do

Column(1)-above(column(1))
Learning never stops.
bhaveshp90
Creator III
Creator III
Author

@sunny_talwar the expression is working now, but I want Last year December POC as base value, and calculating current month POC - December month POC

1.PNG

 

sunny_talwar

Try this

Sum(POC)
-
Sum(TOTAL {<Num_Month, Year, MonthYear = {"$(=MinString(MonthYear))"}>}POC)
Marcos_rv
Creator II
Creator II

ask, if instead of using set analysis, you have it precalculated at that value? you could use the sentence "Previous" to obtain the value of the previous record, also adding an if you want to make sure that it is Project_Number indicated, you should also order it in a desc way. Regards!!!!

bhaveshp90
Creator III
Creator III
Author

@sunny_talwar it is working fine, but when we include November-2017, or October-2017 the base value changed to November-2017, October-2017. I tried to include these variables in the set analysis which is giving me an error. 

Let vPreYear = Year(AddYears(Today(),-2));
Let vPreYearLastMonth = '12';


1.PNG

 

 

sunny_talwar

So, what would you expect to see when you select Dec 2016 to Dec 2018 (2 years)

Jan 2017 - Dec 2016
Feb 2017 - Dec 2016
...
Dec 2017 - Dec 2016

Jan 2018 - Dec 2017
Feb 2018 - Dec 2017
...
Dec 2018 - Dec 2017

bhaveshp90
Creator III
Creator III
Author

Yes, what you've written is correct.

Dec 2016 should be base value for all months from Jan-2017......Dec-2017 

Dec 2017 should be base value for all months from Jan-2018......Dec-2018

 

sunny_talwar

Can you please add a sample where we have 2 years like the above mentioned. I will have to test it out before I gave an expression which will work for you.