Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Lisa2
Contributor
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

YearItemCost
2020Box425
2020Pencil214
2020Chair453
2020Pen283
2021Box315
2021Pencil587
2021Chair752
2021Pen145
2022Box785
2022Pencil214
2022Chair567
2022Pen54
2023Box298
2023Pencil236
2023Chair5447
2023Pen987
2024Box14
2024Pencil52
2024Chair254
2024Pen789
2025Box45
2025Pencil145
2025Chair8
2025Pen369
2026Box25
2026Pencil4
2026Chair1258
2026Pen78
2027Box126
2027Pencil58
2027Chair24
2027Pen2523

 

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

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

Here is what I get:

Error_Capture.PNG

Labels (1)
1 Solution

Accepted Solutions
qliksus
Specialist II
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) 

View solution in original post

5 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this:

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

alex00321
Creator II
Creator II

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

Lisa2
Contributor
Contributor
Author

Nothing is working for me.

Brett_Bleess
Former Employee
Former 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.
qliksus
Specialist II
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)