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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Lotfi96
Regular Visitor

Using a filter to get the last date

Hello,

 

I'd like to ask a question about a measure I've been making recently, I'm trying to get the last value from the amount column based on a date, the columns look like this:

 

Lotfi96_0-1695906459687.png

 

I used the following measure:

 

Measure = CALCULATE(SUM(Database[Amount]), Database[date]=LASTDATE(Database[date]))
 
However I get an error saying that I can't use the LASTDATE function in a true/false expression. Is there another way around to get the latest date? I tried using the max function "Database[date]="Max(Database[date])", but it returned nothing.
 
Any help would be apreciated. 
1 ACCEPTED SOLUTION

I found the solution to the problem, I had to look for it, but it was really simple. There was already a function called " ENDOFMONTH" that I was unaware of. I'll pin this message as a solution in case someone needs it in the future.

View solution in original post

3 REPLIES 3
chonchar
Helper V
Helper V

Hello, 

 

I am new here, but try this:

 

MEASURE Sales[Sales last day] =
        CALCULATE (
            [Sales Amount],
            LASTDATE ( 'Date'[Date]
 
Also, if this works, please accept it as a solution. 

Hello, thank you for your answer, however this doesn't work.

I found the solution to the problem, I had to look for it, but it was really simple. There was already a function called " ENDOFMONTH" that I was unaware of. I'll pin this message as a solution in case someone needs it in the future.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.