Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
durga_bi13
Contributor
Contributor

how to get total sum based on selected years together in a straight table

I have toggle menu selection as year list like last year,this year,2015,2016,2017,2018

How to display total sales based on year selection in Toggle menu for each products

kindly help with this.

i gave =sum(Sales) but it seems values are displaying wrong

 

if i select year as 2015 THEN my result should be          

PRODUCT NUMBER

PRODUCT NAME

2015

2016

TOTAL SALES

01

aa

22

0

22

02

bb

222

0

222

 

 

 

 

 

2 Replies
UserID2626
Partner - Creator III
Partner - Creator III

Total Column formula

Sum({<Business_Date=,MonthYear=,Year=,Year={$(=chr(39) & Concat(Distinct Year, chr(39) & ',' & chr(39)) & chr(39))}>}Amount)

 

Other columns

If(SubStringCount('|' & GetFieldSelections([Year], '|') & '|', '$(=Max({1}Year))') = 1 or GetSelectedCount(Year)=0,
Sum({<Business_Date=,MonthYear=,Year=,Year={"$(=Max({1}Year))"}>}Amount),0)

 

Attached app for your reference

Brett_Bleess
Former Employee
Former Employee

Did the post you received help you with the use case, I realize the QVF file is of no use to you given you are running QlikView, but if the Expressions provided did work, be sure to use the Accept as Solution button on the post anyway.  The only thing of which I can think otherwise is you have something messed up in your data model causing the issue in which case we likely need a reduced version of the app in order to be able to see things to determine if there is something wrong there.  One thing that comes to mind is potentially needing a Master Calendar, so providing a Design Blog link to that below and below that the base Design Blog URL in case you want to search further in that area.

https://community.qlik.com/t5/Qlik-Design-Blog/The-Master-Calendar/ba-p/1471527

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

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.