Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

cancel
Showing results for 
Search instead for 
Did you mean: 
LLing
Creator
Creator

Previous Month Year from Max Month Year

Hi,

I want to compute the sum of amount of the previous month year from the max month year. I have a MonthYear column in my data of this format: Jun 2021, Jul 2021, Aug 2021 etc.

My expression is not detecting any MonthYear and I'm not sure what is wrong.

Expression: Sum({<MonthYear={"$(=Date(AddMonths(Max(MonthYear)),-1),'MMM YYYY')"}>}Amount)

Can someone help please. Thank you.

Labels (4)
1 Solution

Accepted Solutions
abhijitnalekar
Specialist
Specialist

Hi @LLing,

Make sure that your field Monthyear has the proper data type required for the AddMonth function.    

Or try below

Create this field in the script and use this in the expression.

Date(MakeDate(left(Monthyear,3), right(Monthyear,4), 1), 'MMM-YYYY') as Date

 

Regards,
Abhijit
keep Qliking...

View solution in original post

3 Replies
abhijitnalekar
Specialist
Specialist

Hi @LLing,

Make sure that your field Monthyear has the proper data type required for the AddMonth function.    

Or try below

Create this field in the script and use this in the expression.

Date(MakeDate(left(Monthyear,3), right(Monthyear,4), 1), 'MMM-YYYY') as Date

 

Regards,
Abhijit
keep Qliking...
LLing
Creator
Creator
Author

Hi @abhijitnalekar ,

I'm able to resolve my issue based on your inputs. Thank you so much!

abhijitnalekar
Specialist
Specialist

Great!!.. You are welcome

Regards,
Abhijit
keep Qliking...