Finding Numbers for Yesterday
Hi Everyone,
Our daily numbers (sales, manufacturing etc.) works behind by a day. When we say daily, we mean what we did yesterday.
How can I achieve that in a formula?
I do have a list that goes back to the correct date (for the 16th of the month it shows the 15th), but I'm sure how to use that.
The date is based on Date Time and the units are a generic measure.
Thank you!
2 replies
-
Hi
If you already have a list (of one I'm supposing) that is yesterday's date, then simply put the Date hierarchy it belongs to in your Rows / columns / filters drop zone, or wherever you are using it and select the list from that hierarchy's element tree's calculated members panel:
If you want to create a custom member that is always yesterday's date, then create a custom member like the following:
The Date() function returns the current system date of the computer, AddDays(Date(),-1), subtracts one day from the current date to give yesterday's date, then the StrToMember matches that date to your Date hierarchy. Saving the calculation (note it is saved into the Date hierarchy) as a custom member, "Yesterday", whenever you use it, it will be re-evaluated and return values from the model related to yesterday's date:
If you want the yesterday's actual date to be displayed, rather than the name Yesterday, then you can get clever with Dynamic Captions. Here we're using a similar method to set the caption. Get the system date, take off 1 day and format it as Year-Month-Day to match my Date hierarchy.
Now it will look and behave exactly as if you'd picked that date from your existing dates. Of course, tomorrow, it will have the caption of 2025-07-17.
Hope that helps.
Ian
-
This is another quicker technique that I use for similar activities:
- Open the Time Calculations Wizard
- Choose the attribute ("dates")
- Pick the logic you want ("Last Day")
- Choose the "parameterize" option
- It produces a new list/set under dates.
- Put dates on the rows/columns and select the set.
Now you can choose your date from the drop down and it will show you the last day as well.