Qlik Community

Qlik Brasil

Group community for Brazil users. discussion only in Portuguese.

Highlighted
silvia_assuncao
Contributor

How to calculate % by column in pivot table (differet years)

Hi, I have the file attached here and I'd like to calculate the % by year to each column.

Could any of you help me creating this expression?

imagem_qv.PNG


5 Replies
MVP
MVP

Re: How to calculate % by column in pivot table (differet years)

Try this expression:

Sum(Price)/Sum(TOTAL <Year> Price)


Capture.PNG

silvia_assuncao
Contributor

Re: How to calculate % by column in pivot table (differet years)

Thank you!

but now I have a new situtation:

I want to sum only Pants and Shoes and I see that the % by year now is not corret:

erro 2.PNG

Sum(If(Product<>'Shoes',(Price))))
/
((
If(Product<>'Shoes',Sum(Total<Year>(Price)))))

MVP
MVP

Re: How to calculate % by column in pivot table (differet years)

Try this and see if it helps:

Sum({<Product -= {'Shoes'}>}Price) / Sum(TOTAL {<Product -= {'Shoes'}>}Price) //Note the negative sign in red

silvia_assuncao
Contributor

Re: How to calculate % by column in pivot table (differet years)

Yes! thanks a lot! you saved my day

MVP
MVP

Re: How to calculate % by column in pivot table (differet years)

Great

I am glad I was able to help

Best,

Sunny