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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
YesP
Helper I
Helper I

Getting Lates Date with a value from a Semantic Model

Hi,

I am working with a Semantic Model created for a different department.

I created a calendar table with the MAX and MIN date of the date field of the Semantic Model.

I am trying to get the Last Date with a value but my Dax formule is giving me as result the Last date of the month.

This is my Dax: 

Latest Date in Data = CALCULATE(MAX('Calendar'[Date]), REMOVEFILTERS())
 
Result: YesP_0-1733628853453.png

 

 

The Semantic Model has data from all the organization and I am filtering it in Power BI for the Department ID that I need. The last Transaction of the Department ID I am filtering has a date of 12/13/2024.

I want my Dax folmule to bring me 12/13/2024 instead of 12/31/2024

Please advice,

 

Thank you

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This measure pattern should work

Total = sum(Data[Sales])

Last date = calculate(max(calendar[date]),lastnonblank(calendar[date],calculate([Total])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
YesP
Helper I
Helper I

It works great Ashish. Thank you so much!

I have a different question about an issue I am having working with the same Semantic Model lines above. I am trying to get Total Number projects. I am using the following Dax:

Number of Projects = CALCULATE(DISTINCTCOUNT(Project[Project ID]),ALLEXCEPT('Calendar',('Calendar'[Date])))
but it is bringing me the Total Projects of all Departments. The Semantic Model has data from all the organization and I am filtering it in Power BI for the Department ID that I need
Please I will appreciate your help

You are welcome.  Since this question is unrelated to the topic mentioned in the thread, please start a new thread in the forum.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

This measure pattern should work

Total = sum(Data[Sales])

Last date = calculate(max(calendar[date]),lastnonblank(calendar[date],calculate([Total])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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