Calculating Today’s Date in SharePoint has always been a challenge as naturally, the date changes daily. SharePoint will only render a calculated column when the field is updated. Sometimes you may want to see Today’s Date on a Dashboard so you can quickly compare another date (e.g. Current Finish Date), Today’s Date or compare against another metric.
Here is a solution where you can use the BrightWork Project Metrics Feature to calculate Today’s Date and have it available to view on a Dashboard. The advantage of using the Metrics is that they are recalculated nightly resulting in having the correct date for Today, every day.
Here are the steps to build the Today Metric:
1. Create a Custom Report Definition in the BrightWork Reporter Library, and add a Date Column called Today.
Download and unzip this Custom Report Definition you can re-use in your site collection.
You can also reuse an existing Report Definition, however, add an Expression to the Column in the format #Today# (see below).
2. Add a new Metric called “Today”. Make this as Calculated Date Metric and configure it to use the supplied Today Metric.xml Custom Report Definition and the Calculation Settings as below:
Now that you have “Date” calculating as a metric, you can now use it in various places. Here are some examples:
- Add the Metric to your Key Project Metrics Web Parts such as Metric Tiles or Charts.
- Compare against another date e.g. Finish Date.
If you have made this change in a template, you might want to apply these changes to multiple Projects. You can use the BrightWork Design Sync feature to update multiple Projects based on the Template. Just make sure you tick the “Synchronise the settings of common Project Metrics” to pull the metric change down to the site.