Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator III
Creator III

Need help

Hi Community,

I have Year and Month selections..

One requirement...  If i am click year(210), and Month(March)

Table:

CategoryDateCost
Men's Clothes01/19/20101,051
Men's Clothes02/12/20101,178
Men's Clothes02/09/20101,281
Men's Clothes03/24/20101,660
Men's Clothes04/21/20102,004

I want to sum up data  2010 wise,  Month(Jan, Feb and March) 

Depends on Current selections

My output should be

Category           Cost

Men's Cloths     5170  (1051+1178+1281+1660)

If i am click Fed Month

Category           Cost

Men's Cloths     3510  (1051+1178+1281)

if i am click Nov, i want sum up data Jan to Nov

Thanks in Advance

7 Replies
Clever_Anjos
Employee
Employee

It would be easier if you post some data or a sample of your app

QlikCommunity Tip: How to get answers to your post?

Qrishna
Master
Master

This way:

Capture.PNG

Capture.PNG

paulwalker
Creator III
Creator III
Author

Please can you share expression

Qrishna
Master
Master

=Pick(match(Month,'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'),

            sum({$<Month = {'Jan'}>}Cost),

            sum({$<Month = {'Jan','Feb'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar','Apr'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar','Apr','May'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar','Apr','May','Jun'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar','Apr','May','Jun','Jul'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov'}>}Cost),

            sum({$<Month = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'}>}Cost)          

            )

This expression applies to text box.

In case you need for charts,this wont work i guess.

Not applicable

I loaded month as numeric value 1 for Jan,2 for Feb

test:
LOAD * Inline [
Category, Year, Month, Cost
Men's Clothes, 2010, 1, 1051
Men's Clothes, 2010, 2, 1178
Men's Clothes, 2010, 2, 1281
Men's Clothes, 2010, 3, 1660
Men's Clothes, 2010, 4, 2004
]
;

and used this expression and it's working as you want.

=sum({<Month={'<=$(=Max(Month))'}>}Cost)

MarcoWedel

Hi,

another solution could be an As-Of Table like described by hic in this post:The As-Of Table

QlikCommunity_Thread_190297_Pic1.JPG

QlikCommunity_Thread_190297_Pic2.JPG

(The additional table maybe only makes sense if you have other requirements that can be covered with. The solution proposed by QVDTEST1 might be more efficient in your case.)

hope this helps

regards

Marco

hic
Former Employee
Former Employee

The As-Of table is one solution, just like MarcoWedel suggests.

A second solution is to use the Above function in a chart with Month as dimension, with the following expression

Only(Aggr(RangeSum(Above(Sum({$<Month=>} Cost),0,12)), Month)

See The Above Function

HIC