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

Calculate %

I have below formatted data and i want to percentage that are based on year.

%.JPG

Example - ProductA contribution in 2016 is 20 and percentage of contribution would be 33.33 % for that year.

Thanks,

Villyee.

1 Solution

Accepted Solutions
isingh30
Specialist
Specialist

Sum(Sales)/Sum(TOTAL<Year> Sales/100 )

Screenshot.PNG

View solution in original post

11 Replies
adityaakshaya
Creator III
Creator III

Hi Villyee,

A quick question, are you looking to calculate the % within script  or front end?

vanderson009
Creator III
Creator III
Author

I am trying it at object level, means at front end lwvel.

fvelascog72
Partner - Specialist
Partner - Specialist

Hi,

Try with Sum(Sales)/Sum(TOTAL<Year> Sales)

Saludos

isingh30
Specialist
Specialist

Sum(Sales)/Sum(TOTAL<Year> Sales/100 )

Screenshot.PNG

vvira1316
Specialist II
Specialist II

I've got following

=Sum(Sales)/Aggr(Sum({<Year>} Sales), Year)

but I'm missing rows

Percent.PNG

Sunny stalwar1‌ or others can help here.

sunny_talwar

May be this

=Sum(Sales)/Aggr(NODISTINCT Sum({<Year>} Sales), Year)

vvira1316
Specialist II
Specialist II

Yeah, that is correct. But the simple one mentioned by Ishtdeep will work.

I was having challenge as below

=Sum(Sales)/Sum( Total {<Year>} Sales) The curly braces for year were causing whole set sum. I didn't realize that curly braces for year were not required only angular were needed

sunny_talwar

Yup

sunny_talwar

Actually fvelascog72‌ was the first one to propose it and personally I would not multiply by 100 , but rather use number tab to show the expression as percentage