Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I'm new to qlikview.
I'm trying to sum the total negative margin and group that by invoice.
So the result I'm after is the total negative margin of the total invoice.
I tried using the following expression;
sum({<margin={"<0"}>} margin)
however using this expression It is summing the total negative margins line by line rather than the total of the invoice where it is a negative margin.
Try the following expression
=Sum(If(Aggr(Sum(margin),InvoiceId) < 0, Aggr(Sum(margin),InvoiceId),0))
Try something like this: sum({<margin={"<0"}>} total <invoice_id> margin). Replace invoice_id with the name of your invoice dimension.
Hi Thanks for your response,
unforunately the expression you suggested gives me the exact same result as the one I was orginally using.
Although your expression looked like it would work, It still gives me the same result
What I'm trying to do is for example if I have 5000 invoices, I want to sum the margin of the negative margin invoices as a total not a negative margin of a particular line within that invoice.
Thanks for your help
Try the following expression
=Sum(If(Aggr(Sum(margin),InvoiceId) < 0, Aggr(Sum(margin),InvoiceId),0))