Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Ramki
Contributor II
Contributor II

Previous month count on selected month

Hi Team,

While comparing the values between  selected month and previous month, the result of previous month showing as 0.

Expression for previous month is: count({<Month={'$(=getfieldselections(AddMonths(Date#(Month))),-1}>} EquipmentID) .

It would be great if any one can suggest me on the expression.

Regards,

Ramki

Labels (1)
4 Replies
NitinK7
Specialist
Specialist

first create variable for year and pre_month

varibales:

vYear=Date(Addmonths(Date#(Max(your date field),'your date field format'),-1),'YYYY')

vPrv_Month=Date(Addmonths(Date#(Max(your date field),'your date field format'),-1),'MMM')

 

then write below exp

Count({<Year= {$(=vYear)},Month={$(=vPrior_Month)}>}EquipmentID)

 

Ramki
Contributor II
Contributor II
Author

There is no date filed, data loading from excel and  month , year are text fields which are entered manually in the excel.

 

Regards,

Ramki

NitinK7
Specialist
Specialist

try below , may be it will work, if not then please attach your excel file for year and month

vYear=Date(Addmonths(Date#(Max(Year),'YYYY'),-1),'YYYY')

vPrv_Month=Date(Addmonths(Date#(Max(Month),'MMM'),-1),'MMM') 

Ramki
Contributor II
Contributor II
Author

Hi , 

please close this topic.

 

Regards,

Ramki