Steps : I created three parameters and displayed them on workbook: -
Start date - see screenshot
End date - same as start date
Select date aggregation - see screenshot
see screenshots : -
Create a Calculated field ( i named it "zselected date aggregation") - prefixing Z will have all your custom fields at the bottom of the list, it makes them easier to find.
enter the following code into "zselected date aggregation" , in the code 'datecreated' is my date variable replace it with yours.
CASE [Select Date Aggregation]
WHEN "Yearly" THEN DATENAME('year',[datecreated])
WHEN "Quarterly" THEN DATENAME('quarter',[datecreated])
WHEN "Monthly" THEN DATENAME('month',[datecreated])
WHEN "Weekly" THEN STR(DATE(DATETRUNC('week', [datecreated])))+ " to " +
STR(DATE(DATETRUNC('week', DATEADD('week', 1, [datecreated]))) -1)
WHEN "Daily" THEN DATENAME('day',[datecreated])
WHEN "Weekday" THEN DATENAME('weekday',[datecreated])
WHEN "Hourly" THEN DATENAME('hour',[datecreated])+ ":00"
WHEN "Half Hourly" THEN (str(datepart('hour',[datecreated]))+":"+
Step 3: create a second calculated field ( i named it "zDate range") , enter the following code in it (replace 'datecreated' with your date variable)
[datecreated]>= [Start Date] and [datecreated]<= [End Date]
Step 4: drag "zselected date aggregation" capsule in columns or rows field as per your requirement.
Step 5: Drag "zDate range" to filters and set it to "True"
Also ensure that all three of your parameters are set to visible for the user (right click and then "show parameter")
If this helped you , please feel free to send me a thanks