Qlik Community

Ask a Question

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: 
q11hhg
Contributor III
Contributor III

AddMonths last 12 months

Hi there 

I want to calculate the last 12 months customers by using this formula, but it does not work properly, the result is not correct. I do not know how to fix it, can anyone please help me?  Is this caused by my [Date] column? 

Count(distinct{<Date={">=$(=date(addmonths(Max(Date),-12)))<=$(=date(Max(Date)))"}>}Order_Customer_ID)

q11hhg_0-1614267234139.png

 

2 Replies
micheledenardi
Specialist II
Specialist II

The set analysis seems correct.

Can you please post some example data and the expected result?

q11hhg
Contributor III
Contributor III
Author

I think something is wrong with my Date, after I adjusted the formula like this, it worked 

 

 

Count(distinct{$<Date={">=$(=date(addmonths(Max(Date),-12),'DD/MM/YYYY'))<=$(=date(Max(Date),'DD/MM/YYYY'))"}>}Order_Customer_ID)