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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Question

Hi,

I have this expression: Count(if(Round(Interval(Max(financial_date)-created_date)/30)<6,OrigCustomerNumber,0))

but this is not working, how can I count the customer numbers that fulfill the if condition?

Thank you!

Labels (1)
7 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You can achieve this by using sum instead of count..

     Sum(if(Round(Interval(Max(financial_date)-created_date)/30)<6,1,0))

Hope it helps

Celambarasan

Not applicable
Author

another question sir,

I have a calculated dimension:

=if((Year(ProductCreatedDate)=$(vMaxFinYear) and (ProductCreationMonth= $(vCurrMonth)) ) and item_type='Sales Inventory',item_description)

my variable $(vCurrMonth) contains different months depending on the selections made by the user.(can be multiple)

$(vCurrMonth) = 'Jun' OR 'Jul' OR 'Sep'

but this is not working, why? please do help me on this.

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try with this,

     use vCurrMonth = Concat(Distinct ProductCreationMonth,',')

     Then

     =if((Year(ProductCreatedDate)=$(vMaxFinYear) and SubStringCount($(vCurrMonth),ProductCreationMonth)>0 ) and item_type='Sales Inventory',item_description)

Hope it helps

Celambarasan

Not applicable
Author

I think substringcount is not the one that i'm looking for because I want to show the data based on the value of vCurrMonth which might be ('Jun' or 'Jul' or 'Aug') or other months based on user selections

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     What expression are you using for the variable vCurrMonth?

Celambarasan

Not applicable
Author

=chr(39) & Concat(DISTINCT fin_month_name & chr(39),' or ' & chr(39))

with my current calculated dimension, it only gets the first value

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try using match function.

      =if((Year(ProductCreatedDate)=$(vMaxFinYear) and Match(ProductCreationMonth,$(vCurrMonth)) ) and item_type='Sales Inventory',item_description)

In condition we cann't compare fieldname ='jan' or 'jul because first it evaluates fieldname='jan' then it take 'jul' as separate expression.

Celambarasan