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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
bchager6
Super User
Super User

Return the most recent date with charges

Hi everyone...

 

I would like to create a column that returns the most recent date from my table (the month column), per projectid, where there are charges. Please see below. In this example the most recent date would be 9/1/2020 and I'd like to bring that value in to a table visualization. There are multiple projectids in the data and there are 0 values in many cases and I'm thinking I will need to use the LASTDATE function along with ALLEXCEPT.

 

Any help here is appreciated!

 

bchager6_0-1607549074243.png

 

 

1 ACCEPTED SOLUTION
Anand24
Super User
Super User

Hi @bchager6 ,

 

You can use the below DAX in a new measure to get latest date for ProjectIDs:
Max Date of ProjectID = CALCULATE(MAX('Table'[Month]),ALLEXCEPT('Table','Table'[ProjectID]))

Reference Image:

allexcept.PNG

 

Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

So in another column of the same viz, you want to show 0.02 in all rows where the project id is 89.  Am i correct?  Please share the download link of your PBI file with cases where the value is 0.  Please also show the expected result.


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

@Ashish_Mathur  Thanks for your response, but no actually. In another column I want to note which date is the latest date for a project which has costs associated. So I think I'd need to add a condition to @Anand24's  solution where the expression would first check to see if the value field is <>0.

 

CALCULATE(MAX('Table'[Month]),ALLEXCEPT('Table','Table'[ProjectID]))

Anand24
Super User
Super User

Hi @bchager6 ,

 

You can use the below DAX in a new measure to get latest date for ProjectIDs:
Max Date of ProjectID = CALCULATE(MAX('Table'[Month]),ALLEXCEPT('Table','Table'[ProjectID]))

Reference Image:

allexcept.PNG

 

Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!

@Anand24  Thanks for your help. I just added the bold faced code below to what you sent me and it accomplishes what I want it to. 

Max fcst. date per project =
CALCULATE(
MAX('table'[month]),
ALLEXCEPT('table',
'table'[projectid]),
'table'[value] <> 0
)

@Anand24  Thank you. That should help but it also needs to consider whether the particular date contains a value. In my example, 9/1/2020 could be zero, where the most recent date with values would be 8/1/2020.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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