Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stacked Bar - 100% Calculation

Hello,

Below is my data. I want to insert a Stacked Bar chart which Displays  "Learning Plan" and "No Learning Plan" as percentages.

My Dimension is LOB.

I am struggling with the expression, could you please help me with this?

LOBPopulationLearning PlanNo Learning Plan
LOB125002000500
LOB2300020001000
LOB3350025001000
LOB4250010001500

Regards,

Varun.M

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Only() is an aggregation function and shouldn't be used around another aggregation:

Try like this

Learning Plan %:

=Sum([Learning Plan]) / Count([Standard Id])

No Learning Plan %:

= 1 - Sum([Learning Plan]) / Count([Standard Id])

use bar chart style 'stacked' and format as percent on number tab.

View solution in original post

6 Replies
swuehl
MVP
MVP

Maybe like this:

Use LOB as dimension, and two expressions:

=Only([Learning Plan]) / Only([Population])

=Only([No Learning Plan]) / Only([Population])

Set style of the bar chart to stacked. Select 'Show in percent' on number tab for both expressions.

Not applicable
Author

Hi Stefan,

Thanks for your reply. "Population"  and " No Learning Plan" are  calculated columns.

Population = Count(StandardID),

No Learning Plan = [Population]-[Learning Plans]

so when I use the above formula.I get an error message! Any other workaround this?

Regards,

Varun.M

swuehl
MVP
MVP

Just replace Only(FIELDNAME) with your expressions.

Where you reference another expression and you don't want to use it in your chart, expand the Expression reference to the full expression text.

Not sure how you calculate Learning Plans, but No Learning plan would look like

=Count(StandardID) - WhateverAggregationUsedForLearningPlan

Not applicable
Author

Expression for LearningPlan = sum(LearningPlan).

As advised above, I get  " Error in Expression : ')' expected"

Learning Plan =  only(sum([Learning Plan])/only(count([Standard Id]))

No Learning Plan = only(Count([Standard Id]-only(sum([Learning Plan]))

Not sure where I am going wrong! Kindly assist.

swuehl
MVP
MVP

Only() is an aggregation function and shouldn't be used around another aggregation:

Try like this

Learning Plan %:

=Sum([Learning Plan]) / Count([Standard Id])

No Learning Plan %:

= 1 - Sum([Learning Plan]) / Count([Standard Id])

use bar chart style 'stacked' and format as percent on number tab.

Not applicable
Author

Thank you sooo much! This helps.