Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Formula problem

Good morning everybody,

I have a date created field which I have made the date and year in my script.

Date(DateCreated)                  as [Created Date],
Month(DateCreated)                as [Month],
Year(DateCreated)                  as [Year],

My current selection box is on November and 2013.

I want to calculate the amount of contracts terminated/disposed of in the month of November.

I have a variable - vMaxDate, which is max([Created Date]).

My formula to calculate the amount of terminated contracts is:

=count(if([Disposal Date]>=MonthStart(vMaxDate) or ([Disposal Date]<=vMaxDate),[Agreement Number]))

it gives me value of 9. But if I do a manual check on our operating system it should be 226.

Even if I change my formula to count(if([Disposal Date]>='01/11/2013' or ([Disposal Date]<='30/11/2013'),[Agreement Number]))  is still gives me 9.

What am I doing wrong?

Thanks

*R*

14 Replies
Not applicable
Author

Try This


=count({<[Created Date]={'>=$(MonthStart(vMaxDate)) <=$(vMaxDate)'}>}[Agreement Number])



sudeep_d
Partner - Creator
Partner - Creator

count({1}if([Disposal Date]>='01/11/2013' or ([Disposal Date]<='30/11/2013'),[Agreement Number]))

MayilVahanan

Hi

Try like this

=count({<[Created Date]={">=$(MonthStart(vMaxDate)) <=$(vMaxDate)", Month=, Year=}>}[Agreement Number])


And check the date format. If date format is mismatched, then it doesn't give correct answer.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi there,

This gives me the all the terminations ever. Not just for November 2013.

Thanks

*R*

Yousef_Amarneh
Partner - Creator III
Partner - Creator III

your selection is November so the expression will give you the correct answer without using if statement or set analysis !!

Yousef Amarneh
Not applicable
Author

HI Yousef,

The reason I am setting an if statement is due to the fact that I have live and terminated inforamtion.

So I need the data where the status of the agreement is terminated.

I have tried the formula:

count(if(Status='T",[Agreement Number]) but that also only gives me a value of 9.

The reason I then decided to bring in the disposal date is because live data will not have a Disposal date.

Thanks

Not applicable
Author

Check your Disposal Date.
perhaps it is null. In this case you need to replace it with the alt() function to get a valid test.

Fabrice

Anonymous
Not applicable
Author

To avoid date format errors ,

always create a numeric field eg... num([Created Date]) as [Created Date Num]

=count({<[Created Date Num]={'>=$(num(MonthStart(vMaxDate))) <=$(num(vMaxDate))'}>}[Agreement Number])

Regards

Nitin

Yousef_Amarneh
Partner - Creator III
Partner - Creator III

Could you please upload the qvw file

Yousef Amarneh