Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
nranweiler
Contributor
Contributor

Previous Month and Previous 12 Months Measure

Need help with two measures I'm trying to create to be inserted as column's in my app. 

The Prev Month is set to this: 
Sum({<[Common Date.autoCalendar.Date]={">=$(=(MonthStart(AddMonths(Today([Common Date]),-1)))))<=$(=(MonthEnd(AddMonths(Today([Common Date]),-1)))))"},Year=,Month=>} [Total Cost])

It returns this below: 

nranweiler_0-1702490784338.png

The data in the table is only showing $0

nranweiler_1-1702490840601.png

Any Ideas on what I have wrong and how to set a measure to the Previous 12 Months as well?

Labels (1)
1 Solution

Accepted Solutions
MatheusC
Specialist
Specialist

@nranweiler 

In your expression, try to adjust the syntax, there are parentheses left) in the analysis of the set.

Example previous month
Sum({<[Common Date.autoCalendar.Date]={">=$(=(MonthStart(Today(),-1)))<=$(=(MonthEnd(Today(),-1)))"},Year=,[ Month ]=>} [Total Cost])

 

Example -12

sum({1<[Common Date.autoCalendar.Date]={">=$(=AddMonths(Monthstart(today()),-12))<=$(=MonthEnd(today(),-1))"}>} [Total Cost])

In this example, without considering the current month

Att,

Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

2 Replies
MatheusC
Specialist
Specialist

@nranweiler 

In your expression, try to adjust the syntax, there are parentheses left) in the analysis of the set.

Example previous month
Sum({<[Common Date.autoCalendar.Date]={">=$(=(MonthStart(Today(),-1)))<=$(=(MonthEnd(Today(),-1)))"},Year=,[ Month ]=>} [Total Cost])

 

Example -12

sum({1<[Common Date.autoCalendar.Date]={">=$(=AddMonths(Monthstart(today()),-12))<=$(=MonthEnd(today(),-1))"}>} [Total Cost])

In this example, without considering the current month

Att,

Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
nranweiler
Contributor
Contributor
Author

Thank you so much!!! I'm new to Qlik so the editor is a learning challenge for me.