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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
manideep78
Partner - Specialist
Partner - Specialist

Multiple field sum

Dear Community,

I have field called Item. This Item is an Island

item.jpg

Again Each Item is a Separate field.

Ex:

Capture.JPG

If I select Item Ball, I need Sum(Ball) =30

If I select Item Pen, I need Sum(Pen) = 70

If I select both Ball and Pen, I need Sum(Ball)+ Sum(Pen) = 100 or Sum(Ball+Pen) =100

like wise if I select all the items, I need sum of all the items to be added.

How can I achieve this?

Thanks in advance.

Regards

Manideep

17 Replies
sunny_talwar

Try this for your 7 Item concern:

=Sum($(='['&GetFieldSelections(Item,']+[', 999999)&']'))

sunny_talwar

Try this for the 0 concern may be:

=RangeSum($(='Sum(['&GetFieldSelections(Item,']),Sum([', 999999)&'])'))

CELAMBARASAN
Partner - Champion
Partner - Champion

Try this, it will give you desired result I guess

=$(='RangeSum(' &Concat('Sum([' & Item &'])', ',') & ')')

Hope it helps

manideep78
Partner - Specialist
Partner - Specialist
Author

Perfect sunindia

Thanks

manideep78
Partner - Specialist
Partner - Specialist
Author

Actually, the second one resolved both.

sunny_talwar

Awesome

I am glad it worked.

Best,

Sunny

manideep78
Partner - Specialist
Partner - Specialist
Author

Hi sunindia,

Now I want to put this expression in alternate states like

Original Expression:

=RangeSum($(='Sum(['&GetFieldSelections(Item,']),Sum([', 999999)&'])'))

using Alternate states:

=RangeSum($(='Sum({AS_NoSel * $}['&GetFieldSelections(Item,']),Sum([', 999999)&'])'))


I tried the second expression, But not giving the exact result.

What's wrong in the above expression?

Thanks & Regards

Manideep

manideep78
Partner - Specialist
Partner - Specialist
Author

Is there a way we can add the Alternate states in the above expression