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

current month and the month before

 

Hi experts,

I used this function
Sum({1<[Month] ={"$(=Max([Month]))"}>} [turnover])
Sum({1<[Month ={"$(=Max([Month])-1)"}>} [turnover])
to calculate the turnover for the current month and the month before but in the result I still have 0. Can u help me please ??

thank u 

 

Thank You.

1 Solution

Accepted Solutions
rubenmarin

Hi, can you confirm that it's turnover and not Turnover (with initial uppercase, it will be different fields)

 

If not maybe it's a format issued: one month is a number and the other is a string? anyway.. in script you can create a field with year and month as a number, it helps to compare january vs december:

Year(DateField)*12+Month(DateField) as YearMonthNum

 

Your expression should work with this field:

Sum({1<[YearMonthNum] ={"$(=Max([YearMonthNum]))"}>} [turnover])
Sum({1<[YearMonthNum] ={"$(=Max([YearMonthNum])-1)"}>} [turnover])

 

View solution in original post

2 Replies
rubenmarin

Hi, can you confirm that it's turnover and not Turnover (with initial uppercase, it will be different fields)

 

If not maybe it's a format issued: one month is a number and the other is a string? anyway.. in script you can create a field with year and month as a number, it helps to compare january vs december:

Year(DateField)*12+Month(DateField) as YearMonthNum

 

Your expression should work with this field:

Sum({1<[YearMonthNum] ={"$(=Max([YearMonthNum]))"}>} [turnover])
Sum({1<[YearMonthNum] ={"$(=Max([YearMonthNum])-1)"}>} [turnover])

 

Sa20
Contributor II
Contributor II
Author

Thank you so much