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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
VictorV
Helper I
Helper I

How to Return Latest Value in Column Based on Date

Hi everyone,

I need help on this one, I want to create a measure that show lastest Amount based on month. For example, If I select month February, it will show lastest amount of January is 3000.

 

Please, help me!!!

 

Screenshot 2024-04-10 100901.png

1 ACCEPTED SOLUTION

Hi,

Does this measure work?

Balance = calculate([Total],calculatetable(lastnonblank(calendar[date],calculate([Total])),datesbetween(Calendar[date],minx(all(calendar[date]),calendar[date]),min(calendar[date])-1)))

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

View solution in original post

7 REPLIES 7
VijayP
Super User
Super User

@VictorV   Try this file attached

 

VijayP_0-1712720792733.png

 




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Tks for your replied, but I don't want it SUM, I want it appear like the last value of that month, you can see in my pic, the last day is 1/30/2024 with 3000, so I want it appear amount 3000 like that

 

For example in your pi file, if you select month feb, it should be appear 422 of 1/21, cause this is the last day in that month 

VictorV_0-1712725095813.png

 

Ashish_Mathur
Super User
Super User

Hi,

Ceate a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name column by the Month number column.  Create a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of the Calendar Table.  Create a slicer and drag Year and Month name from the Calendar Table.  Select April 2024.  Write these measures

Total = sum(Data[Amount])

Balance = calculate([Total],lastnonblank(calendar[date],calculate([Total])))

Hope this helps.


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

Hi, tks for your replied, It close to what I want, I want it like if I select March, it will appear last value of Feb, in this case is 389, but your measure is the lastest value in that month instead

VictorV_1-1712725309636.png

 

Hi,

Does this measure work?

Balance = calculate([Total],calculatetable(lastnonblank(calendar[date],calculate([Total])),datesbetween(Calendar[date],minx(all(calendar[date]),calendar[date]),min(calendar[date])-1)))

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

Thanks a lot, it's work perfect

You are welcome.


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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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