Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
wassimharfoush
Partner - Contributor II
Partner - Contributor II

Compare current sum Rev VS last year sum Rev

I am trying to compare the sum of Revenue for period based on current selection of a DateField VS The same period for

previous year and I am using the expression for previous year period:

Sum({<Datefield={'$(=addyears(DateField-1))'}>}Rev)

That works when the user select a single period but doesn't work when the user select multi period.

1 Solution

Accepted Solutions
muniyandi
Creator III
Creator III

Hi Alec,

Close this threat .

Thanks,

Muni

View solution in original post

24 Replies
Anonymous
Not applicable


Sum({<Datefield={" >= $(=addyears(Min(DateField), -1)) <= $(=addyears(Max(DateField), -1))"}>}Rev)

Anonymous
Not applicable

Try this expression:

Sum({$+<[Fiscal Year]={"$(=AddYears([Fiscal Year],0)-1)","$(=AddYears(Min([Fiscal Year]),0)-1)"}>}Rev)

If you don't want to show them without a selection then you need to active the conditional expression check box and add this expression

GetSelectedCount([Fiscal Year])>0

Regards

alec1982
Specialist II
Specialist II

None of the above work.. Any other suggestions?

Best,

Alec

alec1982
Specialist II
Specialist II

Hi Waild,

the fiscal year field that you use, is it a year column? or full date? The solution doesn't work on my end.

Best,

Alec

Anonymous
Not applicable

This one should work

Sum({$<DateField={">= $(=addyears(Min(DateField),0) -1) <= $(=addyears(Max(DateField),0) -1)"}>}Rev)

alec1982
Specialist II
Specialist II

Thank you for your help but still not working..

Anonymous
Not applicable

It is a year field. You might need to use Makedate function before addyears if you apply it on a full date. So try it with a year column

alec1982
Specialist II
Specialist II

I also tried the following with no luck:

=Sum({$<RDATEValue={">= $(=addmonths(Min(RDATEValue),0) -12)"," <= $(=addmonths(Max(RDATEValue),0) -12)"}>}REV)

it is not returning error but it returns 0 which means the expression is correct but not sure why it returns 0.

Any help is appreciated

Anonymous
Not applicable

Is RDATEValue a month column?