Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

Current Year vs Sum of previuos Year

Hi Folks,

i have a question: my table does look like:

Year, Turnover, Company

2018, 500, A

2017, 400, B

2016, 300, C

i am using this expression to show the turnover of current year:

Sum({<Year = {"$(=Year(today()))"}>}Turnover)

my question is:

how can i show via set expression the sum of previous year (2017 + 2016 = 400 + 300)

i want to show the comparison like:

2018,   All Previous Years

500,             700

does anybody have any idea?

Thanks a lot

Beck

1 Solution

Accepted Solutions
sunny_talwar

My bad, I missed a closing double quote

Sum(TOTAL {<Year = {"$(='<' & Year(Today()))"}>} Turnover)

View solution in original post

6 Replies
sunny_talwar

May be this

Sum(TOTAL {<Year = {"$(='<' & Year(Today()))}>} Turnover)

beck_bakytbek
Master
Master
Author

Hi Sunny,

thanks a lot for your help, i tried to implement that way, but it does not work

Beck

sunny_talwar

My bad, I missed a closing double quote

Sum(TOTAL {<Year = {"$(='<' & Year(Today()))"}>} Turnover)

beck_bakytbek
Master
Master
Author

Sunny thanks a lot for your time and help

qliksensejp
Contributor II
Contributor II

Hello good afternoon.


I was testing the problem you mentioned, I believe the problem is in the field for the year, I made a modification and added the date field of issue in the location of the year column.


EMISSION, Turnover, Company

05/05/2016, 500, A

05/05/2017, 400, B

05/05/2018, 300, C


Then I loaded the file.


LOAD

     EMISSION,

     Date (EMISSION, 'YYYY') the YEAR,

     Turnover,

     Company

FROM

(ooxml, embedded labels, table is Plan1);


I used a text object with the following expression:

=num(sum({$<[ANO]={"$(=Year(Today())-1)"}>} Turnover)+sum({$<[ANO]={"$(=Year(Today()))"}>} Turnover),'#.#00,00')


If you create a column in the expression tab:

sum ({$ <[YEAR] = {" $ (= Year (Today ())-1) "}>} Turnover) + sum ({$ <[YEAR] = {" $ (= Year (Today ()) ) "}>} Turnover)


And it also works with:


= num (sum (TOTAL Turnover), '#. # 00,00')


But for the latter you would need a filter over the years, if you select one or more years, the sum follows the selection.


Hope this helps. Sorry if English is not perfect, I used the google translate.

beck_bakytbek
Master
Master
Author

Hey Rildo, thanks a lot for your help and time,

your way is very informative for me. Many Thanks