Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone!
I have a little problem with the following expression:
I want to calculate the difference between the "Netto" of a period compared to the "Netto" of the same period of the previous year but I don't know how to do that. Please, could anyone text me the right expression?
Thanks!
that exposes an important detail - your date is a time stamp. therefore comparing it with a date will not work. try this:
sum({1<data01={">=$(=timestamp(addyears(yearstart(today()),-1)))<=$(=timestamp(addyears(today(),-1)))"}>} Netto)
its a little bit obvious but have you tried
sum({<Anno={$(=max(Anno)-1)}, seg={+}>}Netto)
assuming seg drives the period within the year
Hi Edwin, Thanks for your answer.
The problem is that your expression calculates the "Netto" of the whole previous but I want to calculate the "Netto" until the date of Today in the previous year.
this assumes that no date is selected. if a date is selected, then that needs to be added in the set analysis modifiers as Date= (for example)
in that case you can add in your set analysis for the prior year component
date={"<$(=addyears(today(),-1)) // date is your date field
this limits the data set to before same date last year, combined with the year = prior year that should cover it
didnt see the date field:
sum({<Anno={$(=max(Anno)-1)}, date01={"<$(=addyears(today(),-1))"} , seg={+}>}Netto)
one more time:
sum({<Anno={$(=max(Anno)-1)}, date01={"<=$(=addyears(today(),-1))"} , seg={+}>}Netto)
another form:
=sum({<date01={">=$(=addyears(yearstart(today()),-1))<=$(=addyears(today(),-1))"}>}Amount)
Do I have to set it in the script?
I think I have to make an Aggregation but I don't know how to write it.
I have to write something like :
Sum( if ( InYearToDate ( data01, Max(data01), -1 ) and segno = '+', Netto ))
Could anyone tell me how to write it correctly?