Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

phucpv9119
New Contributor II

Using "Admonths" in expression

Hi all,

I need to count a number of customer using services in last 1m/3m or 6m, so that i set an expression like that:

count({<[TransDate]={'>=$(admonths(today(),-1))'}>} distinct [Cus.No]) ==> for 1M

count({<[TransDate]={'>=$(admonths(today(),-3))'}>} distinct [Cus.No]) ==> for 3M

count({<[TransDate]={'>=$(admonths(today(),-6))'}>} distinct [Cus.No]) ==> for 6M

However, all these three expressions show the same result!

Please help me to correct that expression. Thank you!

Regards,

PhucPV

1 Solution

Accepted Solutions
MVP
MVP

Re: Using "Admonths" in expression

Try with an equal sign within the dollar sign expansion  and also switch single quotes to double quotes and see if that works

count({<[TransDate]={">=$(=admonths(today(),-1))"}>} distinct [Cus.No]) ==> for 1M

count({<[TransDate]={">=$(=admonths(today(),-3))"}>} distinct [Cus.No]) ==> for 3M

count({<[TransDate]={">=$(=admonths(today(),-6))"}>} distinct [Cus.No]) ==> for 6M

3 Replies
MVP
MVP

Re: Using "Admonths" in expression

Try with an equal sign within the dollar sign expansion  and also switch single quotes to double quotes and see if that works

count({<[TransDate]={">=$(=admonths(today(),-1))"}>} distinct [Cus.No]) ==> for 1M

count({<[TransDate]={">=$(=admonths(today(),-3))"}>} distinct [Cus.No]) ==> for 3M

count({<[TransDate]={">=$(=admonths(today(),-6))"}>} distinct [Cus.No]) ==> for 6M

pablolabbe
Valued Contributor II

Re: Using "Admonths" in expression

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.

phucpv9119
New Contributor II

Re: Using "Admonths" in expression

Yesss, it works great bro! thank you so much for your prompt help!!!