Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
brunolelli87
Creator II
Creator II

Sum the field until that specific date on a chart.

Hello guys,

Thanks for each one here! I'm learning a lot... Qlikview is an amazing software!

I have to create a chart with Dates as Dimension (X-axis of my chart), and the sum of the yearly Revenue until that date (that is shown on the X-axis of my chart) as the Y-axis of my chart.

The Dates as Dimension comes from an excel spreadsheet called Stoks.
The data available at this Stoks.xls spreadsheet is similar to:

DatesClosing
05/05/2020 $               12,33
04/05/2020 $               14,55
05/05/2020 $               17,22
04/05/2020 $               14,22
05/05/2020 $               13,33
04/05/2020 $               12,98
05/05/2020 $               15,88
And so sonAnd so son
01/01/2015$                 11,88

 

From another excel spreadsheet I've some fields, including Period and Revenue:

CompanyPeriodRevenue
BBA131/12/2019 $                  3.251.896,32
BBA130/09/2019 $                  3.030.734,08
BBA130/06/2019 $                  2.617.694,98
BBA131/03/2019 $                  2.541.991,94
BBA131/12/2018 $                  2.480.429,57
BBA130/09/2018 $                  2.441.650,94
BBA130/06/2018 $                  2.017.875,97
BBA131/03/2018 $                  2.213.400,06
BBA131/12/2017 $                  2.194.258,43
BBA130/09/2017 $                  1.998.189,06
BBDC331/12/2019 $                  5.625.780,63
BBDC330/09/2019 $                  5.243.169,96
BBDC330/06/2019 $                  4.528.612,31
BBDC331/03/2019 $                  4.397.646,05
BBDC331/12/2018 $                  4.291.143,15
BBDC330/09/2018 $                  4.224.056,13
BBDC330/06/2018 $                  3.490.925,42
BBDC331/03/2018 $                  3.829.182,11
BBDC331/12/2017 $                  3.796.067,09
BBDC330/09/2017 $                  3.456.867,07

 

As you can see, the periods are expressed as dates, but basically they represent quarters, like 30/09/2017 is the 3rd quarter of 2017. The 31/12/2017 is the 4th quarter of 2017...

Creating a chart with Date as Dimension, the system will show all available dates on X-axis (and It's exactly what I'm looking for).

 

My question is:
On Y-axis, each bar should represent the sum of Revenues from the day that that bar represents, until one year before.

Check this example:
Lets suppose I got the Company BBDC3 on a Date of 05/05/2019.
The Y-axis should represent the sum of Revenues from 05/05/2018 up to 05/05/2018. 

BBDC331/03/2019 $                  4.397.646,05
BBDC331/12/2018 $                  4.291.143,15
BBDC330/09/2018 $                  4.224.056,13
BBDC330/06/2018 $                  3.490.925,42

 

So, I would like to get the result equal to  $ 16.403.770,75.


How can I do it?
I'm getting crazy with it

2 Replies
Vegar
MVP
MVP

You could try to solve it by using set analysis. Try something like this.

 

=sum({<[Period]={">=$(=YearStart(max([Period])))<$(=YearEnd(max([Period])))"}>}[Revenue])

brunolelli87
Creator II
Creator II
Author

Hello

Thanks for all your help, but it's not working... The red line should variate between those dates, and they are not. I'm using the formula you provided for both Revenue and Stocks. The fact is that Revenue belongs to the table where you can find the Period, and Stocks belongs to another table, where you can still find dates, but they are not called Period.

What should I do?

revenue.png