# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for
Did you mean:
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
MVP

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])

2 Replies
MVP

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])

Contributor II
Author

Thank you so much

Community Browser