Filter Month-Year field to the latest month-year of the dataset

I have a dataset at day level and I am creating an analysis at Month-Year level; for which I have created a field calculated as
Month-Year: formatDate({Date},‘MMM-YYYY’)

Now, I want a KPI chart with value of only the latest month in the dataset. (This necessarily won’t be the current month)

I don’t understand, how can this month-year field be used as filter or within calculation for KPI such that, with new month data the KPI updates automatically.

I tried something like this at day level field, but the max aggregation on the date field doesn’t seem to help here

PS: It would have helped if the parameter could take default value as some function output.

Please help!!

Hi! You have the option of setting a filter just on that KPI and could use relative date options. The relative date options allow you to choose relative date from specific date you provide or from a parameter (such as max date in your dataset).

Hey @Kellie_Burton ,
Thanks a lot for your reply.

I am slightly unsure on how to give the parameter a default value of max(date) in the dataset other than using a user level data mapped with dates

Can you please help?

Ummehaani-
You could set the default value of the parameter using relative dates - for example the last day of the previous month. See screenshot below.

Another option would be to create a new calculated field for the measure you want to show in the KPI. For example, if you want to show last month sales you could create a calculation using:

ifelse(dateDiff({Order Date},maxOver({Order Date},[],PRE_AGG),“MM”) = 1, Sales, 0)

You would then use this new calculated field as the value in your KPI.

Best Regards,
Kellie