Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Having trouble with wrong totals in a pivot table, the pivot table columns are year-week or year-month, and rows are invoice data per product. Total should be 87,14 but we are getting 86,57.
I read in another topic that you should put your measure in a aggr function, apparantly it doesn't change the outcome of the measure but only fixes your totals in the pivot table? I just can't get it to work properly, getting 0 as results or just random results.
Measure without aggr:
=Sum({<Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"}>} KamerDagenTeller) /
Only({< Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"} >}[Dagen per week])
One of my tries:
aggr(Sum({<Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"}>} KamerDagenTeller) /
Only({< Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"} >} [Dagen per week]), JaarWeek, [products.description])
If anyone has any ideas or tips, would be very much appreciated.
Was able to fix it after all, had to add the sum and not only order by products.description but also order by locations
sum(aggr(Sum({<Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"}>} KamerDagenTeller), JaarWeek, [locations.H_name3], [products.description]) /
aggr(Only({< Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"} >} [Dagen per week]), JaarWeek, [locations.H_name3], [products.description]))
Not sure what your totals are supposed to represent, but you would need to aggregate the aggr(), e.g. sum(aggr(stuff)) or avg(aggr(stuff)) to tell Qlik how to handle the fact that multiple rows are returned.
The totals are perfect with this version, the results (before they're totalled) are wrong though, so I assume my aggr() is still in a wrong position?
SUM(aggr(Sum({<Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"}>} KamerDagenTeller) /
Only({< Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"} >} [Dagen per week]), JaarWeek, [products.description]))
Was able to fix it after all, had to add the sum and not only order by products.description but also order by locations
sum(aggr(Sum({<Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"}>} KamerDagenTeller), JaarWeek, [locations.H_name3], [products.description]) /
aggr(Only({< Type*={'Finance Logs', 'Invoice Rows'}, KamerbezetJN={"Ja"}, Datum={"<$(=today())"} >} [Dagen per week]), JaarWeek, [locations.H_name3], [products.description]))