Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
madhuqliklondon
Creator II
Creator II

Aggr to calculate total basket value

Hi all,

I am trying to find out total basket value . The situation is I am trying to analyse discount codes used and total basket value.

Discount codes will apply only on some products but not on all. For example , an order contains 2 products one with discount one without discount as below. When apply filter discount code, sum of sales is giving me only item values where discount code applied. But I am trying to find out total basked value instead.

OrderNoItemPriceDiscount codeDiscount amountvalue
1123  10     10
1134  20   Summershop       6  14

I have created filter on discount code ,when I select summershop code on filter total order value - sum(Value)it is giving me is 14 but I would like to see total basket value which is 24 including non discount products as well.

Can anyone help.

Thanks in advance

8 Replies
raman_rastogi
Partner - Creator III
Partner - Creator III

Hi

Try This

Aggr(NODISTINCT sum(Value),[Order No])

arulsettu
Master III
Master III

maybe like this

Aggr(sum(Value),OrderNo)

madhuqliklondon
Creator II
Creator II
Author

Hi Arul,

It is still giving me 14 only.

madhuqliklondon
Creator II
Creator II
Author

Hi Raman,

Same value still.

Or
MVP
MVP

This isn't an AGGR issue per se - you're just reducing your data past the point you want to see. If you've selected the specific discount code, you've removed the non-discount row from your data. You'll have to use set analysis to get it back.

Sum({<[Discount code] = >} Value) - this will get the right value if you are not showing a detailed breakdown. If you need to show the order total in addition to each individual line, you can aggr() by OrderNo.

jonathandienst
Partner - Champion III
Partner - Champion III

Do you want to override the selection on [Discount code]?

=Sum{<[Discount code]>} value)

Or select OrderNo's that contain at least one line with that code, but include all rows? Then something like:

=Sum{<OrderNo = P(), [Discount code]>} value)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
arulsettu
Master III
Master III

if you want to ignore the filter selection maybe try this

Aggr(Sum({<[Discount code] = >} Value),OrderNo)

rajivmeher
Creator
Creator

Hi madhuqliklondon

If I understand your requirement correctly, you are looking for something which should ignore any selections / filter in your report and provide you with sales total. In that case you can try the following:

SUM({1} VALUE)

If you need the sum per OrderNo, than please try the following.

AGGR(SUM({1} VALUE), OrderNo)

Regards

Rajiv.