Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cumulative Expression

Hello,

I would like to create a Cumulative expression, let's call it "Cumulative This Year".

On my Sheet, I have a list box titled "Month", that list the 12 months of the year.

Instead of my field "Cumulative This Year" adding all of the data for for the current year, I want it to stop at the month selected in the List box.

If June is selected as the Month, "Cumulative This Year" will consist data from January - June.

I have the follwing in my expression.  Is there a way to adjust the ''Month" based on the value selected in the List box?

Sum({<DepletionYear= {"12"},Month = {"01","02","03","04"}>} Depletion)

Thanks in advance for your assistance,

Stephanie Smith

5 Replies
manojkvrajan
Luminary
Luminary

Stephanie, Should the application take the max month on selecting multiple months in the list box? 

For example, on selecting May, October and November, should it take January through November? Please confirm.

Not applicable
Author

Yes, that is exactly what I am looking for

daveamz
Partner - Creator III
Partner - Creator III

Hi Stephanie,

    Set a variable vMonth = Month

then:

Sum({<DepletionYear= {"12"},Month = {"<=$(vMonth)"}>} Depletion)

Regards,

David

Not applicable
Author

Hello David,

That sounds like it will work.  But how to do a set a variable?  Do I put it in my Expression script?

Thanks,

Stephanie

daveamz
Partner - Creator III
Partner - Creator III

Settings > Variable Overview (Ctrl+Alt+V) > Add > vMonth for variable name, =Month for Definition. Equal sign is mandatory.

Untitled.png