Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
minhas
New Member

Time Intelligence Function (Latest Month Sales Calculation)

Hi there,
I am working with a dataset, which has sales data starting from January 2022 to March 2024. I was trying to calculate latest month sales, i.e. March 2024. I want to make it dynamic so that if I add sales of upcoming months, it will show latest month.
I have a sales table and a calender table.
When I using dates from sales table, it kind of work:

Revenue (CM) =
CALCULATE(
[Total Revenue],
FILTER(
Data,
EOMONTH(Data[Date of Purchase],0) >= EOMONTH(MAX(Data[Date of Purchase]),0) &&
EOMONTH(Data[Date of Purchase],0) <= TODAY()

)
)

But when I use Calender table it doesn't work.

Revenue (Latest Month) =
CALCULATE(
[Total Revenue],
FILTER(
Calender,
Calender[End of Month] >= MAX(Calender[End of Month]) &&
Calender[End of Month] <= TODAY()

)
)​

Any help will be highly appreciated. Thanks

2 REPLIES 2
lbendlin
Super User
Super User

yes, in this case you need to use the latest [Date of Purchase] from the fact table. But you need to define that as a variable outside of CALCULATE. 

Hi Ibendlin, thanks for your reply.

It actually works when I use latest [Date of Purchase] from fact table but doesn't work when using dimension table, i.e. Calendar table. And it seems like there is an issue with Calendar table. I tried several things to debug, such as importing fresh calendar table in different formats, creating new calendar table using Dax it doesn't work.

I more thing I have noticed, whenever I create or import new calendar table, it's hierarchy disappears as soon as I mark it as date table or after data modeling and connecting to fact table. Any idea what's going on?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.