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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikview979
Specialist
Specialist

Based on selection Above all months data

Hi Experts,

Here i want the Sum(sales) based on month selection with above all months


For example:-

My variable like

Variable3=MonthName(max(Date))

expression:-

=sum({<Month={'$(Variable3)'}>}Sales)

Here if i select may month its showing may month data its fine.

my requirement is:-  if i select  APRIL i want data from April,Mar,Feb,Jan

for that i have written expression like this

=sum({<Month={'<=$(Variable3)'}>}Sales(here i am getting result is Zero)


is there any mistake in expression  ,please let me know.



36 Replies
qlikview979
Specialist
Specialist
Author

Hi Experts ,

Help me on that loveisfailvinieme12swuehl‌@

Anil_Babu_Samineni

Expression seems simple only, Would you able to provide sample to check

Let me explain little more how it will work

sum({<Month={">=$(=AddYears(Max(Month),-4)) <=$(=Max(Month))"}>}Sales)


PS - This will return when you click the month for April this will return as April, March, Feb, Jan.


The same way will work for Date as well if Date format is bit clear to understand each together


sum({<Date={">=$(=AddYears(Max(Date),-4)) <=$(=Max(Date))"}>}Sales)


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
Kushal_Chawda

How values in Month field looks like?

prieper
Master II
Master II

Depends a bit on your formatting of data,

basically your expression is correct, if you replace the ' with "

Suggest to try first with pure numerics.

Peter

qlikview979
Specialist
Specialist
Author

Hey Anil,

thanks,

Here  i have four years of data 2012 to  2015, if i select Nov 2015 ,

it was showing Nov 2015 to Jan 2012  i don't  want like that

if i select Nov 2015 ,i want here from Nov 2015 to Jan 2015 sales only.

May i know Why My Expression is Not working

qlikview979
Specialist
Specialist
Author

Hi Bro,

Monthname like

Jan 2012

,

,

,

,

Nov 2015

qlikview979
Specialist
Specialist
Author

Hi Brother,

I tried with " "

its not working

Anil_Babu_Samineni

Cool, Now you need to sort by help of YearStart. Make sure to use Date Format in case any weird happens

sum({<Month={">=$(=YearStart(Max(Month))) <=$(=Max(Month))"}>}Sales)


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
vinieme12
Champion III
Champion III

see this post

Calculating rolling n-period totals, averages or other aggregations

Accumulative Sums

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.