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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mma_sig
Contributor
Contributor

Error in expression: ')' expected

Hi, I am trying to fix my expression and am stuck in figuring out where that ')' is actually missing. Seems it isn't missing but something else is going on.

IF($(v_ConversionStage) = '5. Sold',
    (
        Count({<CRMOpportunityStatusName = {'5. Sold'}, 
               CRMCreatedDate = {">=$(=Date(AddMonths(Max(CRMCreatedDate), -$(vLookbackPeriod))))<=$(=Max(CRMCreatedDate))"}>} 
              DISTINCT CRMOpportunityID)
        /
        Count({<CRMCreatedDate = {">=$(=Date(AddMonths(Max(CRMCreatedDate), -$(vLookbackPeriod))))<=$(=Max(CRMCreatedDate))"}>} 
              DISTINCT CRMOpportunityID)
    ),
IF($(v_ConversionStage) = '4. Clock Stop',
    (
        Count({<CRMOpportunityStatusName = {'4. Clock Stop'}, 
               CRMCreatedDate = {">=$(=Date(AddMonths(Max(CRMCreatedDate), -$(vLookbackPeriod))))<=$(=Max(CRMCreatedDate))"}>} 
              DISTINCT CRMOpportunityID)
        /
        Count({<CRMCreatedDate = {">=$(=Date(AddMonths(Max(CRMCreatedDate), -$(vLookbackPeriod))))<=$(=Max(CRMCreatedDate))"}>} 
              DISTINCT CRMOpportunityID)
    ),
IF($(v_ConversionStage) = '3. Proposal',
    (
        Count({<CRMOpportunityStatusName = {'3. Proposal', '2. Qualified'}, 
               CRMCreatedDate = {">=$(=Date(AddMonths(Max(CRMCreatedDate), -$(vLookbackPeriod))))<=$(=Max(CRMCreatedDate))"}>} 
              DISTINCT CRMOpportunityID)
        /
        Count({<CRMCreatedDate = {">=$(=Date(AddMonths(Max(CRMCreatedDate), -$(vLookbackPeriod))))<=$(=Max(CRMCreatedDate))"}>} 
              DISTINCT CRMOpportunityID)
    ),
IF($(v_ConversionStage) = '2. Qualified',
    (
        Count({<CRMOpportunityStatusName = {'2. Qualified'}, 
               CRMCreatedDate = {">=$(=Date(AddMonths(Max(CRMCreatedDate), -$(vLookbackPeriod))))<=$(=Max(CRMCreatedDate))"}>} 
              DISTINCT CRMOpportunityID)
        /
        Count({<CRMCreatedDate = {">=$(=Date(AddMonths(Max(CRMCreatedDate), -$(vLookbackPeriod))))<=$(=Max(CRMCreatedDate))"}>} 
              DISTINCT CRMOpportunityID)
    ),
    // Optional: else clause if none of the above conditions are met
    0
))))



Any pointers are welcome.

Labels (5)
1 Solution

Accepted Solutions
MatheusC
Specialist II
Specialist II

@mma_sig 

try putting variables in single quotes 

IF('$(v_ConversionStage)' = '5. Sold',
....


Regarts,
Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

2 Replies
MatheusC
Specialist II
Specialist II

@mma_sig 

try putting variables in single quotes 

IF('$(v_ConversionStage)' = '5. Sold',
....


Regarts,
Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
mma_sig
Contributor
Contributor
Author

Hi @MatheusC,

Thank you, that actually did it, learned something just now!

Best,

mma