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: 
Not applicable

Multiple If Statements


I am running into trouble trying to get a count of data based on multiple if statements. This is my expression that i am currently using:

=

if(Num(Month(Modification_Date)=Num(Month(Today(),if(ERM_sales_cycle_stage_id='6'),count(ERM_deal_product_id),'0')

Ultimately i am looking to see a MTD count of deals that have a sales cycle id of 6.

Any help would be greatly appreciated.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi Patrick,

Couple of closing parenthesis are missing and need to use 'and' operator to use multiple conditions:

Try:

=if(Num(Month(Modification_Date))=Num(Month(Today()))  and ERM_sales_cycle_stage_id='6',count(ERM_deal_product_id),'0')

Regards

Neetha

View solution in original post

5 Replies
Not applicable
Author

Just at a quick glance it looks like you're missing parentheses, try...

=if(Num(Month(Modification_Date)=Num(Month(Today(),if(ERM_sales_cycle_stage_id='6'),count(ERM_deal_product_id),'0'))))

...if that doesn't work can you post a sample QVW?

Colin-Albert
Partner - Champion
Partner - Champion

In your load script, add a new field  using the preceding load script below to add the Mod_MonthName field.

     Load

          monthname(Modification_Date) as Mod_MonthName,

          * ;

     Load               // This is the existing Load command...

          xxx as Modification_Date,

          <rest of your load script>

Then you can use this expression in your chart.

    count(     {< Mod_MonthName={'$(= MonthName(Today()) )'}, 

                         ERM_sales_cycle_stage_id={6}

                    >}   ERM_deal_product_id )

Not applicable
Author

Post you QVW file, its most likely you are missing some parenthesis

mukesh24
Partner - Creator III
Partner - Creator III

Hi,

count(if(Num(Month(Modification_Date)=Num(Month(Today())) and ERM_sales_cycle_stage_id='6',ERM_deal_product_id)))

Anonymous
Not applicable
Author

Hi Patrick,

Couple of closing parenthesis are missing and need to use 'and' operator to use multiple conditions:

Try:

=if(Num(Month(Modification_Date))=Num(Month(Today()))  and ERM_sales_cycle_stage_id='6',count(ERM_deal_product_id),'0')

Regards

Neetha