Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dschuebel
Contributor II
Contributor II

Set Analysis Formula with Parameter

Hi together,


I have the following Set Analysis Formula with Parameters:

fCount =Count({$< Field1 = {'$1'}, Field2  = {'$1'}, Date = {$(=$5)}  > } [Value]  )

If I set the values and variables directly into the formula, like

fCount =Count({$< Field1 = {'value1'}, Field2  = {'value2'}, Date = {$(=$(vD_AddXMonthsRange(-6)))}  > } [Value]  )


it works. But if I want to use the formula with Parameters, like


=$(f_Count(value1,value2,$(vD_AddXMonthsRange(-6))))


i got an error. Unfortuanetly I can´t find the error for this


Thanks for your help!


6 Replies
Miguel_Angel_Baeyens

Add single quotes to the parameter 3

=$(f_Count(value1, value2, '$(vD_AddXMonthsRange(-6))'))

Also, replace $5 by $3

dschuebel
Contributor II
Contributor II
Author

Hey Miguel,

thanks for you reply. Unfortunately it not helps.

For better understanding, followed my formula for vD_AddXMonthsRange:

CHR(39) & '>=' & AddMonths(vD_CurrentDateInput, $1) & '<=' & vD_CurrentDateInput & CHR(39)

I used $1, $2 and $3. It was only a mistake in my post

Best regards

Miguel_Angel_Baeyens

Is the output of the AddMonths() function in the same format than the field "Date"?

Also, always use Chr(34) or " when the right side of the set modifier is a search (in this case, a range) and not a fixed value.

dschuebel
Contributor II
Contributor II
Author

Hey Miguel,

the format from the AddMonths function is in the same Format. Please find attached my Test-Application about this problem.

I tried to use Chr(34), but I have the same problem .

Miguel_Angel_Baeyens

I would go for modifying the fSum variable to

Sum({$<

  Field1  = {'$1'},

  Field2  = {'$2'},

  Datum = {">=$(=AddMonths(Datum, $3))<=$(=Date(Max(Datum)))"}

  >}

  [Value]

)

The expansion within the expansion, while maybe possible, is returning already calculated values instead of text. This expression above in the fSum will work, though.

dschuebel
Contributor II
Contributor II
Author

Hi Miguel, thanks for your response.

Unfortunately, if I use this formula I´m not so flexible, because I don´t want only use formulas like the  AddXMonths, I want to use also some other formulas for set the Date Parameter