Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Syntax error

Hi,

I am writing the below syntax to get total sum but not getting proper result.

Please advise what wrong i am doing here.

sum({<fMonthCD={$(=max(fMonthCD)-1),$(fReportMetricKeyId)={1}}>}fCallAnsweredBeforeThreshold)

fmonthCD is in format like "201507", "201508"... so on and under column i have values like 1, 2, 3.....

i want to get the sum for max of (fmonthCD).

Regards,

Prasanta

Tags (1)
11 Replies

Re: Syntax error

Hi,

what is in field fReportMetricKeyId it seems 1,2,3 and confirm it is field not variable then try like

=sum({< fMonthCD = {$(=max(fMonthCD)-1)}, fReportMetricKeyId = {'1'} >} fCallAnsweredBeforeThreshold)

Regards

Anand

MVP
MVP

Re: Syntax error

You cannot have a variable or a function on the left hand side of your set analysis modifier

sum({<fMonthCD={$(=max(fMonthCD)-1),$(fReportMetricKeyId)={1}}>}fCallAnsweredBeforeThreshold)

May be you can try with an If here:

Sum({<fMonthCD={$(=max(fMonthCD)-1)>} If($(fReportMetricKeyId) = 1, fCallAnsweredBeforeThreshold))

Not applicable

Re: Syntax error

Hi,

Thanks for your reply,

Please check the screen shot, as i am not sure why the max function is not working here.

Capture.JPG

MVP
MVP

Re: Syntax error

What do you see when you add Max(fMonthCD) in a text box object or KPI object?

Not applicable

Re: Syntax error

as in the aove screen shot, i m only getting zero.

MVP
MVP

Re: Syntax error

Is there a chance the fMonthCD is a text field? and its Max cannot be calculated?

Can you test this: Sum({<fMonthCD={$(=MaxString(fMonthCD)}>} fCallAnsweredBeforeThreshold)

Not applicable

Re: Syntax error

if fmonthCD have values like 1, 2, 3 you can use Max function

sum({<fMonthCD={"$(=max(fMonthCD)-1)"},fReportMetricKeyId={1}}>}fCallAnsweredBeforeThreshold)


If you fmonthCD have 201507, 201508 like that you need modify your expression:


sum({<fMonthCD={"$(=Date(AddMonths(Date(max(fMonthCD),'YYYYMM'),-1),'YYYYMM'))"},fReportMetricKeyId={1}}>}fCallAnsweredBeforeThreshold)

Not applicable

Re: Syntax error

Try like below:

sum({<fMonthCD={"$(=max(fMonthCD)-1)"}>}fCallAnsweredBeforeThreshold)

Not applicable

Re: Syntax error

i can calculate max(fmonthCD). see the screen shot.

but dont know why its not returning a result while using max inside my set analysisCapture.JPG

Community Browser