Automatically Reporting on Previous Calendar Month

This little snippet is used in a filter and automatically looks at the previous calendar month. cast([Sales Team].[Client Contacts].[Start Date],date) between _first_of_Month(_add_months(CURRENT_DATE,-1)) and _last_of_month(_add_months(CURRENT_DATE,-1)) If the date is left as a timestamp then the last of the month is 2013-04-30 00:00 which means that a client contact that occurs at 9am would not be picked … Continue reading Automatically Reporting on Previous Calendar Month

Formatting an ID Number

This snippet takes an ID number and displays it in the format of 3-3-4 (e.g. 123 456 7890) substring(cast([Customers].[Account Detail].[Account Number],varchar(10)),1,3)+' '+ substring(cast([Customers].[Account Detail].[Account Number],varchar(10)),4,3)+' '+ substring(cast([Customers].[Account Detail].[Account Number],varchar(10)),7,4)+' ' Its a simple substring operation, withthe account number being cast as a 10 character string