Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
salleninsd
Creator
Creator

Last Month End Date formula in my calculation

Hello,

I am trying to set a calculation that returns a count on the last day of the month, from the prior month.

This is my formula that works for last month, and I want to replace "2018-09-30" with a formula so I don't have to change it every month.  I can't seem to get the syntax right:

Count({ $<  [Census_Daily.CensusDate]={"2018-09-30"}>}  [Census_Daily.CensusMRN])

I only have Census_Daily.CensusDate as a date field in my table, and I cannot connect that to my master calendar, because it is already being used by another date dimension.

I appreciate any suggestions you can send my way

1 Solution

Accepted Solutions
dplr-rn
Partner - Master III
Partner - Master III

You mentioned you tried a few things so would help if you share a sample file.

What i use usually is below

Define variable with your date logic (below is assuming you want last day of previous month)

vLastCensusDate

=Date(monthend(addmonths(today(),-1)),'YYYY-MM-DD')

use variable in set analysis like below

Count({ $<  [Census_Daily.CensusDate]={"$(=vLastCensusDate)"}>}  [Census_Daily.CensusMRN])


View solution in original post

3 Replies
dplr-rn
Partner - Master III
Partner - Master III

You mentioned you tried a few things so would help if you share a sample file.

What i use usually is below

Define variable with your date logic (below is assuming you want last day of previous month)

vLastCensusDate

=Date(monthend(addmonths(today(),-1)),'YYYY-MM-DD')

use variable in set analysis like below

Count({ $<  [Census_Daily.CensusDate]={"$(=vLastCensusDate)"}>}  [Census_Daily.CensusMRN])


salleninsd
Creator
Creator
Author

Thank you, Dilip!!!  This appears to have worked for me.

I appreciate your help!

dplr-rn
Partner - Master III
Partner - Master III

no problems