Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
cmutombo
Contributor III
Contributor III

About formula COUNT if two conditions

Hi Community, 

I have an issue of syntax with formula COUNT if two conditions. My formula is :

=Count({$<DocSource>}{$<POT={'Paid on Time'}>}{$<[MonthName(PaymentDate)]={"$(=MonthName(Today()))"}>}DocSource)

1. First condition is : POT ='Paid on Time'

2. Second condition is : MonthName(PaymentDate) = MonthName(Today())

But when I run, Only second condition is running.  The first condition is ignored

Please help with the correct syntax 

Thanks in advance.

 

9 Replies
MayilVahanan

Hi @cmutombo 

Try like below

Count({<PaymentDate={">=$(=MonthStart(Today()))<=$(=MonthEnd(Today()))"},POT={'Paid on Time'}>}DocSource)

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

Thanks a lot MayilVahanan

regards,

 

cmutombo
Contributor III
Contributor III
Author

Hi MayilVahanan

I come again to you with this formula  : 

=Sum({$<[DATE_]= {"$(=Date(Today()-1))"},SERVICE={'VOICE'}>}REVENUE)

For a sum if :

1. DATE_ = Yesterday

2. SERVICE = "VOICE"

I don't have a good result. Is the syntax good ?

Thanks in advance.

 

 

 

 

MayilVahanan

Hi @cmutombo 

Might be, ur date format is different.

=Sum({$<[DATE_]= {'$(=Date(Today()-1,'YYYY-MM-DD'))'},SERVICE={'VOICE'}>}REVENUE)

-- change ur date format respectively. And also, check whether u have data yesterday or not.

Please close the ticket by marking correct answer / like. so that, it helps other for similar issue.

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

Hi MayilVahanan

Yes, I have data in my data base

But, Qlik say : Errors in Expression : 

=Sum({$<[DATE_]= {'$(=Date(Today()-1,'YYYY-MM-DD'))'},SERVICE={'VOICE'}>}REVENUE)

I am agree with you to change Today() format. 

regards, 

 

 

 

cmutombo
Contributor III
Contributor III
Author

MayilVahanan

I found the good format, but syntaxes issue still continue :

1. =Sum({$<date( date#(DATE_,'M/D/YYYY h:mm:ss TT','M/DD/YYYY'))= {"$(=Date(Today()-1))"},SERVICE={'VOICE'}>}REVENUE)

or 

2. =Sum({$<[DATE_]= {"$(=date( date#(date(Today()-1), 'M/DD/YYYY') , 'M/D/YYYY h:mm:ss TT')"},SERVICE={'VOICE'}>}REVENUE)

Both of two are failed. May be for syntaxes (special characters)

 

cmutombo
Contributor III
Contributor III
Author

Hi MayilVahanan

this is the correct way

MANY THAAAANKS !! 

=Sum({$<[DATE_]={"$(=timestamp(date(today()-1)))"},SERVICE={'VOICE'}>}REVENUE)

MayilVahanan

Hi @cmutombo 

Can you close the thread by marking correct answer..

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

Yes, I can, But how to do it ?