PowerShell script to create Dates.csv file
Overview
CreateDatesFile.ps1 creates Dates.csv, the date table file used by Portfolio Slicer.
This file is one of the required external files loaded into the workbook.
Why This File Is Needed
Portfolio Slicer reports rely on a continuous date table for time-based analysis.
That means the workbook needs a file that contains:
- one record per date
- every date from
MinDateup to today
This is much safer to generate automatically than to maintain by hand.
Inputs Used by the Script
The script normally reads:
MinDatefrompsConfig.txt- the target output folder from script configuration
MinDate is especially important. If it changes, Dates.csv needs to be rebuilt so the workbook date table still matches the rest of your setup.
Output
The script creates or refreshes:
Dates.csv
The file is normally created in the PSData folder and then loaded into Portfolio Slicer together with the other external data files.
What the Result Looks Like
The final file contains tab-separated values with a header.

Practical Notes
Dates.csvshould start at the sameMinDateused in your workbookConfigtable- if
MinDatechanges, rebuild the file - if
Dates.csvis missing, many date-based reports will not refresh correctly