Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Sub Totals not equalling


Hi

I've added an expression in my table that returns a zero based on the condition and it seems to be working ok but for some reason the column total is still including the value of the records that return zero

  So I'm returning zero when ActualCostsLC - SalesActualCostslC = 0 otherwise I'm bringing in the sum of PlannedCostsLCV0.

=

if(sum(ActualCostsLC)- sum(SalesActualCostsLC) = 0 , 0, sum(PlannedCostsLCV0))

The report returns zero for the condition but when I add a subtotal I still get the values in the total that have been excluded

9 Replies

Re: Sub Totals not equalling

Try this:

=Sum(Aggr(if(sum(ActualCostsLC)- sum(SalesActualCostsLC) = 0 , 0, sum(PlannedCostsLCV0)), YourDimensions))

Not applicable

Re: Sub Totals not equalling

Hi

Thanks but it didn't work, for some reason it bought in all of the values

Re: Sub Totals not equalling

That is strange, I would have expect the individual rows to have returned the same result, but only subtotal to add up each of the row. Are you trying to do this in a pivot table or Straight Table?

Not applicable

Re: Sub Totals not equalling

Sorry , the values were excluded but the subtotal was the same, for the dimension in the formula I'm brining in the dimension that I'm subtotalling on ?

Not applicable

Re: Sub Totals not equalling

so the individual rows are returning the same result but the total is still not working and its a pivot table

Re: Sub Totals not equalling

Add all the dimensions and see if that helps.

Not applicable

Re: Sub Totals not equalling

Thanks I've got it working now

Re: Sub Totals not equalling

Awesome

I am glad it worked out for you.

Best,

Sunny

Not applicable

Re: Sub Totals not equalling

Hi Thomas

PFA the qvw. It may help you

Regards

Chitra

Community Browser