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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
vardhancse
Specialist III
Specialist III

Getting Current Month and Year & Previous Month and Year QlikSense

Hi,

I have one requirement like:

1. By default "previous-month" and "current-year" should be taken in expression

2. On top of Month and Year selections, expression should calculate for "previous month" and "current year"

For an instance:

a. if we select January and 2019, previous month should be December and Year should be 2018

b. If we select February and 2019, previous month should be January and Year should be 2019

Created 2 variables like:

vLatestMonth: IF(GetSelectedCount(MonthName)=0,Month(Date(AddMonths(Today(),-1),MonthNames)),MonthName)

vLatestYear: IF(GetSelectedCount(Year)=0,Year(Today()),Year)

 

Labels (1)
0 Replies