Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
qliknewbie_1
Contributor II
Contributor II

Previous month sum with addmonths

Hi,

I need to get sales of previous month when using a slicer for a month. 

I can't get this to work. I'm able to get the previous month by using =addmonths(Dato,-1).

qliknewbie_1_0-1666855281592.png

 

How can I add this to my sum function?

Thanks.

3 Replies
vinieme12
Champion III
Champion III

if you have month dates as the dimension in the chart it will only show corresponding period data

you need to use the above() function 

 

example

Dimensions

MonthName

Measure

sum(Sales)   <-- this will show that months sales

Above(sum(Sales))  this will show sum(Sales) for the row above the current row

 

refer below

 

https://help.qlik.com/en-US/sense/August2022/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRe...

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
qliknewbie_1
Contributor II
Contributor II
Author

Well, I would like to use it as a KPI and not in a table, which means I still need a measure to calculate this..

vinieme12
Champion III
Champion III

latest month

=sum({<Datefield={">=$(=Date(Monthstart(Max(Date))))<=$(=Date(Max(Date)))"}>}Sales)

Prior Month

=sum({<Datefield={">=$(=Date(Monthstart(Max(Date),-1)))<=$(=Date(Monthend(Max(Date),-1)))"}>}Sales)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.