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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

no of days between max date and latest date from same column

Hi All,

 
I need to calculate no of days between max date - latest date from the same columns for each product.
details are below :
Latest date and refreshdate.PNG
1 ACCEPTED SOLUTION

@Anonymous this make sense and here is the solution,  add following measures

 

Recent Date = CALCULATE( MAX( Table3[Date] ), ALLEXCEPT( Table3, Table3[Data] ) )

Latest Date = CALCULATE( MAX( Table3[Date] ), ALL() )

# of Days = DATEDIFF( [Recent Date], [Latest Date], DAY )

I believe above will meet your requirement, take some time to read this post on how to get answer quickly

 

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

@Anonymous do you have refresh date in your data model, if yes, you can use datediff function to calculate # of days.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi , Thanks for your response,

 

as mentioned - i have only one column in my data model( MYTable(date) ,max date would be my refreshdatemax(MYTable(date)) , and latest date would be latest MYTable(date).

 

formula would be max(MYTable(date)) - latest (MYTable(date).) we need to build this logic .

 

Thanks

@Anonymous confusing part is your example dataset doesn't have May 20th, 2019 as latest date, as per your example dataset the latest date is May 18th, 2019.

 

So if I have to work on example data set, am I using May 18th, 2019 as most recent date or today's date.

 

Just a note, if you are providing sample data, make sure your expected result is based on that sample data, it just adds extra confusion what you want?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thanks for your prompt response ,

 

and sory for confusion .

 

yes please use may 18th 2019.

 

Thanks

 

@Anonymous isn't in that orange will have recent date = May 18th, 2019 and differnce of days will be zero? Another confusing part on your question.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

here is the sample datahere is the sample data

@Anonymous this make sense and here is the solution,  add following measures

 

Recent Date = CALCULATE( MAX( Table3[Date] ), ALLEXCEPT( Table3, Table3[Data] ) )

Latest Date = CALCULATE( MAX( Table3[Date] ), ALL() )

# of Days = DATEDIFF( [Recent Date], [Latest Date], DAY )

I believe above will meet your requirement, take some time to read this post on how to get answer quickly

 

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.