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!
i meant use it in your expression i thought you were using it in a text box?:
=sum({<Anno={$(=max(Anno))} , seg={'+'}>}Netto) -
sum({<date01={">=$(=addyears(yearstart(today()),-1))<=$(=addyears(today(),-1))"}, seg={'+'}>}Amount)
There's something which's not working. The second term, sum({<data01={">=$(=addyears(yearstart(today()),-1))<=$(=addyears(today(),-1))"}, segno={'+'}>} Netto), gives me back " 0,00€" instead of the "Netto" of the previous year
see how it is used in my sample.
there may be something else going on with other fields in your data model. could it be there is no Seg=+ in prior year? maybe attaching a QVW would help in trouble shooting your issue. but the suggested expression should work ofr the requirements you gave,
as a way to figure out what is going on try this first:
sum({1<data01={">=$(=addyears(yearstart(today()),-1))<=$(=addyears(today(),-1))"}>} Netto)
or sum({1<Anno={2019}}>} Netto)
this will ignore all selections and let you check if there are indeed values for last year period to same date last year or just for 2019. before remove the 1 identifier from your set analysis, look at what is currently selected then go from there
This is the situation 🤔 I have to see something, not "0", haven't I?
can you pls try this:
sum({1<data01={">=1/1/2019<=11/26/2019"}>} Netto)
assuming your date format M/D/YYYY
Also, can you pls list both Anno and data01? pls select 2019 in Anno and see what values are selectable in data01.
there is nothin wrong with the set analysis phrase
{">=$(=addyears(yearstart(today()),-1))<=$(=addyears(today(),-1))"}
so there is something else affecting your sum
This is what i see.. I can't understand what's going wrong!
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)
just make sure the brackets are in the right places. i just typed it without carefully checking the bracket placements