Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Sa20
New 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

Re: current month and the month before

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

Re: current month and the month before

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
New Contributor II

Re: current month and the month before

Thank you so much