Parameter Date Truncation

I’m trying to create a parameter so that a user can choose how to rollup data by a certain date aggregation type, either day, week, month, year and I’m wondering what is the best way to do this in Sigma?

Hey Zachary,

Great question! The first step would be to make a text parameter with each value of date truncation you would like to see. Next, you can use this formula to truncate your worksheet!

Switch([Date Granularity Parameter], “Year”, DateTrunc(“year”, [Date Column]), “Quarter”, DateTrunc(“quarter”, [Date Column]), “Month”, DateTrunc(“month”, [Date Column]), “Week”, DateTrunc(“week”, [Date Column]))