I’m trying to create a field that shows WoW/MoM (depending on the selected parameter value) of a metric feedbacks .
The table has a dimension field in the row and a Period field (the formula is ifelse(${Period}='Weekly', truncDate('WK', {feedback_date}), ${Period}='Monthly', truncDate('MM', {feedback_date}), truncDate('YYYY', {feedback_date}))) in the column. This can be easily achieved using the table calculation directly, but I wanted to create a calculated field to use the WoW/MoM difference. I tried using periodOverPeriodDifference(feedbacks, Period, MONTH, 0) but for some reason it returns 0…
The end result would be what’s in the screenshot: I want recommendation type in the row, date (monthly or weekly, depending on the parameter I select in the column, and feedbacks, #avg rating, rating change and rating change * feedbacks 4 metrics.
It also doesn’t work if I use the parameter directly as periodOverPeriodDifference(distinct_count({feedback_id}),Period, ${Period}, 1). as I got this error
Expression {{argumentName}} for function {{functionName}} has incorrect argument type {{incorrectArgumentType}}. Function syntax expects {{functionSignature}}.
Can you try the other way round like :
ifelse( condition1, periodOverPeriodDifference formula based on condition1 ,
condition2, periodOverPeriodDifference formula based on condition2…)
Period formula does not support parameter, so you have to condition it likewise using the period keywords directly based on the paramater value.