Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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

11 Replies
its_anandrjs

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

sunny_talwar

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
Author

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

sunny_talwar

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

Not applicable
Author

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

sunny_talwar

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
Author

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
Author

Try like below:

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

Not applicable
Author

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