Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
luciozanarotto
Contributor
Contributor

Aggr in Pivot Table

Hi, starting from a data base of sales I have to attribute among the various costs also those of the 3 agents (B, M, R), in practice:
a. I take the total CostoAM (external variable) and multiply it by% CPersAM (the weight of the single agent on the total of their 3 costs)
b. I distribute it on the basis of the turnover made by each single agent (I want every line of sale to have its cost so as to make any possible processing)

The formula of the measure AREA Mng is:

sum({$<AreaM2={"M"}>}Qty*ASP)/sum(total{$<AreaM2={"M"}>}(Qty*ASP))*$(CostoAM)*[%CPersAM]+

sum({$<AreaM2={"R"}>}Qty*ASP)/sum(total{$<AreaM2={"R"}>}(Qty*ASP))*$(CostoAM)*[%CPersAM]+

sum({$<AreaM2={"B"}>}Qty*ASP)/sum(total{$<AreaM2={"B"}>}(Qty*ASP))*$(CostoAM)*[%CPersAM]

In photo 1) it runs but when I lower the field AREA M to a level below the function sum only where there are unique values ​​(only on EXPORT there is only one agent), in fact it asks me for an aggregation but if I add an AGGR/SUM function on the whole formula don't runs ... I have tried in various other ways.

Thanks for any help

Immagine.pngImmagine2.png

0 Replies