String operations to get it right
We have seen one example of performing string manipulation in a macro to swap the columns of a slicer in Chapter 7, Working with Dimensional Models. In this recipe, I will show you more macro functions to manipulate the values and how to achieve the required functionality using them.
Let's say that a report is required to show sales by Date and Product line. This report should show data only for the current month (full month).
Getting ready
Create a simple list report with Date, Product line, and Quantity as columns:
How to do it...
In this recipe, we will see how to use some useful macro functions like current_timestamp
, as follows:
Open Query Explorer. Go to the query used by the list object.
Add a new detail filter and define it as:
[Date] between #timestampMask (_first_of_month($current_timestamp),'yyyy-mm-dd')# and #timestampMask(_last_of_month($current_timestamp),'yyyy-mm-dd')#
Run the report to test it. Unfortunately, the
GO Sales
database doesn't hold...