Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
martinovedana
New Contributor II

Sum above values only when a dimension value is equal to the current one

Hi guys, I can't figure out how to sum above rows only when the rows have a field value equal to the current one.

Two dimensions: CAR and COLOR

Value QUANTITY

Let's see the source table:

source.png

I'd like sum for eache row above quantity + current quantity only when color equals to the current one.is what I expect to obtain.

2014-02-27-1141 -001.png

How can I obtain it with formulas ?

thank you

3 Replies
datanibbler
Esteemed Contributor

Re: Sum above values only when a dimension value is equal to the current one

Hi martinovedana,

aggregate: Insert a sum([Quantity]) function in your LOAD.

=> Keep in mind you then need a GROUP BY clause encompassing ALL OTHER fields present in your LOAD.

HTH

Best regards,

DataNibbler

martinovedana
New Contributor II

Re: Sum above values only when a dimension value is equal to the current one

thanks DataNibbler but I can't do it during LOAD because it has to be dynamic based on current selections

datanibbler
Esteemed Contributor

Re: Sum above values only when a dimension value is equal to the current one


Hi,

well, on the GUI, you could use a set_expression to sum up all the items grouped by (the user's current selection) which you can query using GETFIELDSELECTIONS().

Community Browser