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

How can I have the date just before the max/last Date and repeat the process on the whole table?

Hello,

I'm trying to calculate the delta between two values in different dates : the firt is the date Max(COD)

 ( Sum({<COD={"$(=Max(COD))"}>*<Contrat={'PRESTA'}>} if([FMonth.autoCalendar.Num]<>[COD.autoCalendar.Num], CapaPresta)) * 130/Hours +(sum( {<COD={"$(=Max(COD))"} >} if(Contrat = 'PRESTA' , Actual)) +     sum( {<COD={"$(=Max(COD))"}>} if(Contrat = 'PRESTA' , Actual_hors_site)))* 130/Hours

 Now i'm trying to calculate the same value for the date before the max(COD) so I tried this: I replaced the Max(COD) by :

{<COD={"$(=monthend(addmonths(Max(COD), -1)))

 But it doesn't work.

5 Replies
Uday_Pasupuleti
Partner - Creator III
Partner - Creator III

Try to put it in a variable and call it in set analysis.
In Variable editor use
vtest = monthend(addmonths(Max(COD), -1))

In expression use
sum({<COD = {"$(vtest)"}>}CapaPresta)
Uday_Pasupuleti
Partner - Creator III
Partner - Creator III

Use single quotes while calling variable(vtest)
sum({<COD = {'$(vtest)'}>}CapaPresta)

Even ur expression is working fine

Sum({<COD = {"$(=monthend(addmonths(Max(COD), -1)))"}>}CapaPresta)
avinashelite

check the format of 

COD

because when you use max it will convert it to a number 

you need to re-format it my enclosing it under Date(max(COD)) 

shyrinesam22
Contributor II
Contributor II
Author

Thank you avinashelite

But I tried to put the variable in a text box so i can see it.

It is a date (DD/MM/YYYY).

avinashelite

Ok , in that case check the format of your field also .....

could you  share the updated expression once , let me check