# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Action-Packed Learning Awaits! QlikWorld 2023. April 17 - 20 in Las Vegas: REGISTER NOW
cancel
Showing results for
Did you mean:
Contributor

## Stacked Bar Chart: Total Items in Year Range

Hello, I am creating a stacked bar chart where it is one stacked bar that includes all items, in a range of years and total cost.  I get an error in the calculation.  How do I fix this?

Below is example data

 Year Item Cost 2020 Box 425 2020 Pencil 214 2020 Chair 453 2020 Pen 283 2021 Box 315 2021 Pencil 587 2021 Chair 752 2021 Pen 145 2022 Box 785 2022 Pencil 214 2022 Chair 567 2022 Pen 54 2023 Box 298 2023 Pencil 236 2023 Chair 5447 2023 Pen 987 2024 Box 14 2024 Pencil 52 2024 Chair 254 2024 Pen 789 2025 Box 45 2025 Pencil 145 2025 Chair 8 2025 Pen 369 2026 Box 25 2026 Pencil 4 2026 Chair 1258 2026 Pen 78 2027 Box 126 2027 Pencil 58 2027 Chair 24 2027 Pen 2523

Here is what I have under Used Dimensions --> Add Calculated Dimension:

=sum({<Year={'>=2020<=2024'}>}Cost)

Here is what I get:

Labels (1)
• ### stacked bar chart

1 Solution

Accepted Solutions
Specialist II

You need multiple results to stack .  why dont you add Year and Item in the dimension and use the expression

sum({<Year={'>=2020<=2024'}>}Cost)

5 Replies
Partner - Specialist III

Try this:

=aggr(sum({<Year={">=2020<=2024"}>}Cost),Item)

Creator II

Hi I use double quote, and it worked: =sum({<Year={">=2020<=2024"}>}Cost)

Contributor
Author

Nothing is working for me.

Employee

The best avenue for you to receive further help would be to attach the QVW file or a sample that shows the issue, so folks can look everything over completely including the data model.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Specialist II

You need multiple results to stack .  why dont you add Year and Item in the dimension and use the expression

sum({<Year={'>=2020<=2024'}>}Cost)

Community Browser