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: 
Anonymous
Not applicable

How to use addmonths in set analysis?

My expression is

count(DISTINCT {1<[Referred to CPS]={'Y'},[Resolved_RTC Month] ={"$(=addmonths(today(),-1))"},[Resolved_RTC Year]={"$(=year(today()))"},BizvsNonBiz_Impact_Incidents={'Business Impacting Incidents'},DateType ={'Resolved_RTC'},[Resolution Code]-={"*Select Resolution Code*"}>}Id)

But my addmonths in expression is not working correctly. I need to calculate the tickets resolved only for the previous month at any given point in time..can somebody please tell me whats going wrong with my set analysis? When i add the addmonths expression my expression stops working completely.

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

What I can make out from your set analysis is you are using a Month field "[Resolved_RTC Month]" to get the month and the search parameter you have passed is "{"$(=addmonths(today(),-1))"}", which will return a date and not the month and that is the reason why your set analysis is not working.

Your set analysis should be as below.

count(DISTINCT {1<[Referred to CPS]={'Y'},[Resolved_RTC Month] ={"$(=Month(addmonths(today(),-1)))"},[Resolved_RTC Year]={"$(=year(today()))"},BizvsNonBiz_Impact_Incidents={'Business Impacting Incidents'},DateType ={'Resolved_RTC'},[Resolution Code]-={"*Select Resolution Code*"}>}Id)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

4 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

What I can make out from your set analysis is you are using a Month field "[Resolved_RTC Month]" to get the month and the search parameter you have passed is "{"$(=addmonths(today(),-1))"}", which will return a date and not the month and that is the reason why your set analysis is not working.

Your set analysis should be as below.

count(DISTINCT {1<[Referred to CPS]={'Y'},[Resolved_RTC Month] ={"$(=Month(addmonths(today(),-1)))"},[Resolved_RTC Year]={"$(=year(today()))"},BizvsNonBiz_Impact_Incidents={'Business Impacting Incidents'},DateType ={'Resolved_RTC'},[Resolution Code]-={"*Select Resolution Code*"}>}Id)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
jonathandienst
Partner - Champion III
Partner - Champion III

What format is the field [Resolved_RTC Month]?

It looks like you are comparing a month field with a date field (from AddMonths()).

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Hi Kaushik

count(DISTINCT {1<[Referred to CPS]={'Y'},[Resolved_RTC Month] ={"$(=Monthname(addmonths(today(),-1)))"},[Resolved_RTC Year]={"$(=year(today()))"},BizvsNonBiz_Impact_Incidents={'Business Impacting Incidents'},DateType ={'Resolved_RTC'},[Resolution Code]-={"*Select Resolution Code*"}>}Id)

Thanks it worked but i used monthname instead of month

Anonymous
Not applicable
Author

Hi Jonathan

I was using an incorrect format of month while comparing and rectified it by the above solution..thanks for the suggestion