Hi check this post.
ifelse( ${PeriodStarting}=‘Day’,truncDate(“DD”,{Adjusted Order Date}), ${PeriodStarting}=‘Month’,truncDate(“MM”,{Adjusted Order Date}), ${PeriodStarting}=‘Quarter’,truncDate(“Q”,{Adjusted Order Date}), truncDate(“YYYY”,{Adjusted Order Date}))
regards, Naveed Ali