Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator III
Creator III

Percentage issue..

Hi All,

PFA,

Here calculating Actual vs Demand

AD %age= Demand/Actual..

--Paul

7 Replies
paulwalker
Creator III
Creator III
Author

Total sum it Should be 100%

MK_QSL
MVP
MVP

Try This.... and it cant be 100% as Actual and Demand is not equal.

AD % age

Alt(SUM(Demand)/SUM(Actual),0)

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

You should always use aggregations in expressions, so I would expect the expression to read like:

sum(Demand)/sum(Actual)

The only time you wouldn't do this if if you were referencing prior columns, eg.:

[Actual Demand] / [Monthly Coverage]

In this case the aggregations are done in the other columns.

Not sure what you mean by the total should be 100% - as each row is independent of the others.  To get the contribution of the demand to the whole you could add an expression like this:

sum(Demand) / sum(TOTAL Demand)

This will divide the value on each row by the total across all rows.

Hope that helps.


Steve

rustyfishbones
Master II
Master II

Hi Paul,

You are saying Demand/Actual.

Should it be SUM(Demand)/SUM(Actual)

regards

Alan

paulwalker
Creator III
Creator III
Author

Hello Steve,

sum(Demand) / sum(TOTAL Demand)

it's show perfect 100% of the data..

why are You using (TOTAL) Function here...



nirav_bhimani
Partner - Specialist
Partner - Specialist

Hi,

If we are using Total Keyword then It will consider Entire set for that Field & show the result.

Formula should be

SUM(Demand)/SUM(Actual)

Regards,

Nirav Bhimani

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Paul,

The TOTAL keyword gives the total for that sum (or any aggregation) regardless of the dimension.  This means you are dividing the Demand for one row by the total demand for all rows (and on the total row it is the Total divided by itself - i.e. 1).

If you create a new expression with just sum(TOTAL Demand) in it you will see it has the same value on every row.

Hope that helps explain.

Cheers,

Steve