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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
gz
Creator
Creator

variable days from previous month

I need a variable that will show me a range of days from last month, the same as elapsed in the current month -1. Today it should be 1.03-23.03, Tomorrow 1.03-24.03

Labels (1)
5 Replies
vikasmahajan

Hi

you can use like this:

You'll need to add something like this:

vPreviousYearMonth = {$(=Year(addmonths(max(Data),-1)))}

vPreviousmonth = Month(AddMonths(DateFull,-1))

=Sum({$<Year = {'=$(vPreviousYearMonth )'}, MonthName = {'=$(vPreviousmonth)'}>} Actual)

 

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
gz
Creator
Creator
Author

I need this year previous month

vikasmahajan

Hi,

Please try this :

Previous month

Month(AddMonths(Today(),-1))

 

Previous Year

Year(AddMonths(Today(),-1))

 

Current Month

Month(Today())

 

Current Year

Year(Today())

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
vikasmahajan

https://community.qlik.com/t5/New-to-Qlik-Sense/Last-year-and-Previous-Month-Calculation/td-p/153072...

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
gz
Creator
Creator
Author

 I count how many days have passed Today()-(monthstart(Today())) , then I need this quantity to mark this number of days (24) as 1.03.2023-24.03.2023

ok, I have start date from previous month 

monthstart(vPreviousMonthYear,) 01.03.2023

and end 

Date(monthstart(vPreviousMonthYear,)+(Today()-(monthstart(Today())))-1)

Then I need Sum