
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Percentage operation between two expressions
Regards,
I have the following: In a simple table with 3 dimensions and 3 expressions,The three dimensions are values of Technology, Area and product.The three expressions are the goal to produce, PRODGOAL = I use an (if) to not add the zero values. PRODUCED = The sum of what is produced per day. PERCENT = division between (PRODUCED / PRODGOAL)
The calculation is done well, but having the total of the column, this result does not add up, it is not expected.
5940/7112 = 63% this bad must be 83%
If PRODGOAL (Produced = 0, 0, sum (PRODGOALS))
PRODUCED = Sum (QTYGOOD)
PERCENT = (Produced / PRODGOAL)
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this
PRODUCIDO/
Sum(Aggr(
If(Sum(QTYGOOD) = 0, 0, Sum(PRODGOALS))
, XnAreaDes.., WRKCTRID, ITEMID))
From the image, I couldn't determine the name of your first dimension, but you need to use that within the Aggr() function.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@JesusAlv4 Are you using QlikView or Qlik Sense? I would like to move this into the correct product forum.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry Sue, it is a Qlikview product, and change the label to the correct forum, thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What exactly are your expressions for the three columns? Are you using column reference for PRODGOAL expression?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Sunny,
With IF sentence, I change the value to ZERO, so that it does not add up to the total production goal.
If (PRODUCIDO = 0, 0, Sum(PRODGOALS))
when I remove those rows of ZERO the calculation of percentage is not correct
example image, 2337/1778 = correct percent 131% not 99%

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is your expression for PRODUCIDO column?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The expression is:
PRODUCIDO = Sum (QTYGOOD)
and
PERCENT = (PRODUCIDO / PRODGOAL)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this
PRODUCIDO/
Sum(Aggr(
If(Sum(QTYGOOD) = 0, 0, Sum(PRODGOALS))
, XnAreaDes.., WRKCTRID, ITEMID))
From the image, I couldn't determine the name of your first dimension, but you need to use that within the Aggr() function.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you,
It works correctly, best regards.
