Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
c_pannese
Partner - Creator
Partner - Creator

Aggr for Totals

Hi All,

sum( aggr (
pick(match(#um,'PL','KG','PZ','CT'),
if(PCU_0='PL',sum({$<Anno={$(vyear)},[%Tp_dato]={1},tipo_omaggio={1},segno={1}>}#qnt*PCUSTUCOE_0)+sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt*PCUSTUCOE_0),
If(PCU_1='PL',sum({$<Anno={$(vyear)},[%Tp_dato]={1},tipo_omaggio={1},segno={1}>}#qnt*PCUSTUCOE_1)+sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt*PCUSTUCOE_1),
If(PCU_2='PL',sum({$<Anno={$(vyear)},[%Tp_dato]={1},tipo_omaggio={1},segno={1}>}#qnt*PCUSTUCOE_2)+sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt*PCUSTUCOE_2)
))),


//nel caso in cui servisse la dimensione vanno cconsiderati i pezzi e i ct in base ai pezzi cy
//sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>} floor(#qnt/peso_medio_agan,1))+
//sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}floor(#qnt/peso_medio_agan,1)),
sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt),

sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt),

if(unita_mag_art='PZ',
sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt*pezzi_cart_kg_agan)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},[%Fattura]={'nd'},tipo_omaggio={1}>}#qnt*pezzi_cart_kg_agan),
sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},[%Fattura]={'nd'},tipo_omaggio={1}>}#qnt))
)

, [%Articolo],#um,unita_mag_art))

and the result is:


QC1.pngNow i'd like to see for each "Cod.Articolo" the Total not considering subdivision on cod_lotto.

The result should be:

QC2.png

Is it possible???

Thank you all.

Labels (3)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be this

sum(TOTAL <[%Articolo], #um> Aggr(
Pick(Match(#um,'PL','KG','PZ','CT'),
if(PCU_0='PL',sum({$<Anno={$(vyear)},[%Tp_dato]={1},tipo_omaggio={1},segno={1}>}#qnt*PCUSTUCOE_0)+sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt*PCUSTUCOE_0),
If(PCU_1='PL',sum({$<Anno={$(vyear)},[%Tp_dato]={1},tipo_omaggio={1},segno={1}>}#qnt*PCUSTUCOE_1)+sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt*PCUSTUCOE_1),
If(PCU_2='PL',sum({$<Anno={$(vyear)},[%Tp_dato]={1},tipo_omaggio={1},segno={1}>}#qnt*PCUSTUCOE_2)+sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt*PCUSTUCOE_2)
))),


//nel caso in cui servisse la dimensione vanno cconsiderati i pezzi e i ct in base ai pezzi cy
//sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>} floor(#qnt/peso_medio_agan,1))+
//sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}floor(#qnt/peso_medio_agan,1)),
sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt),

sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt),

if(unita_mag_art='PZ',
sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt*pezzi_cart_kg_agan)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},[%Fattura]={'nd'},tipo_omaggio={1}>}#qnt*pezzi_cart_kg_agan),
sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},[%Fattura]={'nd'},tipo_omaggio={1}>}#qnt))
)

, [%Articolo],#um,unita_mag_art))

Here I am assuming that [#um] = [Unita di magazzin] and [%Articolo] = [Cod.Articolo]

View solution in original post

5 Replies
sunny_talwar
MVP
MVP

May be this

sum(TOTAL <[%Articolo], #um> Aggr(
Pick(Match(#um,'PL','KG','PZ','CT'),
if(PCU_0='PL',sum({$<Anno={$(vyear)},[%Tp_dato]={1},tipo_omaggio={1},segno={1}>}#qnt*PCUSTUCOE_0)+sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt*PCUSTUCOE_0),
If(PCU_1='PL',sum({$<Anno={$(vyear)},[%Tp_dato]={1},tipo_omaggio={1},segno={1}>}#qnt*PCUSTUCOE_1)+sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt*PCUSTUCOE_1),
If(PCU_2='PL',sum({$<Anno={$(vyear)},[%Tp_dato]={1},tipo_omaggio={1},segno={1}>}#qnt*PCUSTUCOE_2)+sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt*PCUSTUCOE_2)
))),


//nel caso in cui servisse la dimensione vanno cconsiderati i pezzi e i ct in base ai pezzi cy
//sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>} floor(#qnt/peso_medio_agan,1))+
//sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}floor(#qnt/peso_medio_agan,1)),
sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt),

sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},%Fattura={'nd'},tipo_omaggio={1}>}#qnt),

if(unita_mag_art='PZ',
sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt*pezzi_cart_kg_agan)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},[%Fattura]={'nd'},tipo_omaggio={1}>}#qnt*pezzi_cart_kg_agan),
sum({$<Anno={$(vyear)},[%Tp_dato]={1},segno={1},tipo_omaggio={1}>}#qnt)+
sum({$<Anno={$(vyear)},[%Tp_dato]={3},[%Fattura]={'nd'},tipo_omaggio={1}>}#qnt))
)

, [%Articolo],#um,unita_mag_art))

Here I am assuming that [#um] = [Unita di magazzin] and [%Articolo] = [Cod.Articolo]

Anil_Babu_Samineni
MVP
MVP

I can remove this [Unita di magazzin] from TOTAL statement.
Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
c_pannese
Partner - Creator
Partner - Creator
Author

thank you very much!
it works!
c_pannese
Partner - Creator
Partner - Creator
Author

yes it seems work correctly!
Thanks!
sunny_talwar
MVP
MVP

Not sure I understand?