Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm having trouble in calculate yesterday's sales in set analysis.
The today's sales formula works:
Sum({<DateNum={"$(=Max(DateNum))"}>} Value)
But yesterday's sales formula does not:
Sum({<DateNum={"$(=Max(DateNum-1))"}>} Value)
What's wrong?
Didn't you say you have Date and DateNum fields in your app. Not sure where you make selection, but assuming you make selection in Date field, does this work?
Sum({<DateNum={"$(=Max(DateNum)-1)"}, Date>} Value)
No, it still shows 0
That is very strange. Would you be able to share a sample where this isn't working?
I usually try to create flags in Master for easy work...
You can maybe create a flag in Master Calendar
InDay(Date, today(),-1)*-1 | as PD, |
And use
Sum({<PD={1}}>} Value)
Will it be dynamic in UI?
It seems that you always look at today() and compare to it and it's wrong.
I don't need yesterday's date value but the previous date value.
If a user chooses 22/11/2016 so I need to show 21/11/2016's value.
If he chooses 21/11/2016 so I need to show 20/11/2016's value.
Yes it will give you Yesterday's data not Previous Day data.
Try this one in Master Calendar
Day(Date-1) as PreviousDay, <<< for Only Day
Date([Date-1,'DD/MM/YYYY') as PreviousDate <<<< Gives you yesterday's date.
and you can use PreviousDate in front end
Attached
What is the issue with this expression?
Sum({<DateNum={"$(=Max(DateNum-1))"}, Date>} Amount)
I selected 05/05/2011 and I am seeing both current date and previous date amounts. Are you not seeing this when you open the attached?
Thanks, I'll try that