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: 
QS_
Contributor III
Contributor III

Set analysis to get value based on month selection

I am trying to calculate the sum of the debits for the current month using the formula below. I'm not sure what I'm doing wrong here because I get only 0s with this formula.

sum({$<GL_Month={"=$(=Date(Floor(MonthStart(Max(ActualsDate))),'MMM-YYYY'))"}>}Accounted_Debit)

I want to calculate the value for the previous month as well.

GL_Month is the month column that is derived in the script with the following formula :

Date(MonthStart("ActualsDate"), 'MMM-YYYY') as GL_Month,

 

Labels (3)
4 Replies
BrunPierre
Partner - Master II
Partner - Master II

Like this.

... {"=$(=Date(Floor(MonthStart(Max(ActualsDate))-1),'MMM-YYYY'))"} ...

QS_
Contributor III
Contributor III
Author

I tried it with the previous month's calculation and still get 0s, same as the issue I'm facing with the current year

BrunPierre
Partner - Master II
Partner - Master II

Is ActualsDate a timestamp field? You're using Floor() to round numbers in one place but not in GL_Month. Floor() rounds down numbers, so not using it in GL_Month could affect how dates are compared.

Vegar
MVP
MVP

It could ne that you are evaluating when all you need is the string value. Try this

sum({$<GL_Month={'$(=Date(Max(ActualsDate),''MMM-YYYY''))'}>}Accounted_Debit)

Notice the double '' (it is not not single ")