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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
matrin
New Member

Last column value

Hi dear community,

 

I am new on Power BI Desktop and I need some help!

 

I've got a metric named "number of people" that can't be cumulated.

 

I want to return the last value of the column "number of people".

 

In fact, I import a database that provide the details of the number of people every day of the month. However, I don't have the number of the month provided, as the format of the date is "month - year" and can't be changed for some reasons.

To be clear, the file is presented like this:

february; 23

february; 29

february; 19

Thus, I want to return the last value of the column (19) which is in fact the last value of the month.

 

Can you please help me with this?

 

Thanks a lot in advance!!!

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

If these are only Feb, then I think it is difficult. But if they are dates then you can do it easily.

There is very powerful function as part of Feb 2020 release that can help - lastnonblankvalue

https://docs.microsoft.com/en-us/dax/lastnonblankvalue-function-dax

lastnonblankvalue(Date,max(Table[Value])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

V-lianl-msft
Community Support
Community Support

Hi @matrin ,

 

If you want to get the last value of a column, you can try the following DAX.

Measure = CALCULATE(LASTNONBLANK('Table'[Column2],1),ALL('Table'))

If the problem persists,could you please share sample data or sample .pbix?

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

  1. Do you have data for multiple months?
  2. Is there no year column?
  3. Is there an index column to let the user know the order in which the same months should appear?

Share data for more months/year column/index column and shoe the expected result clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
V-lianl-msft
Community Support
Community Support

Hi @matrin ,

 

If you want to get the last value of a column, you can try the following DAX.

Measure = CALCULATE(LASTNONBLANK('Table'[Column2],1),ALL('Table'))

If the problem persists,could you please share sample data or sample .pbix?

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

If these are only Feb, then I think it is difficult. But if they are dates then you can do it easily.

There is very powerful function as part of Feb 2020 release that can help - lastnonblankvalue

https://docs.microsoft.com/en-us/dax/lastnonblankvalue-function-dax

lastnonblankvalue(Date,max(Table[Value])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thanks for your help.

 

In fact, I don't want the maximum value but the very last one of the column.

 

You're probably right, it won't work without days...

 

Hi @matrin ,

 

With the formula I created, I can get the desired results in my test data.

If the problem persists,could you please share sample data or sample .pbix?

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.