Calculated field to pull only a measure's latest monthly value when selecting multiple months

Hi @Diego -

You can use this approach. You can consolidate some of the calcs if needed but I like to go step by step.

1. Create a calculated field that truncates the date to month

c_month

truncdate("MM",{Order Date})

2. Create a calculated field that retrieves the last month (After Filter).

c_last_month

maxOver({c_month},[],PRE_AGG)

3. Create a calculated field that sums only the measure values in the last month.

c_last_month_sales

sumOver(ifelse({c_month}={c_last_month},Sales,0),[],PRE_AGG)

Result:
image

1 Like