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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
jobf
Helper I
Helper I

Difference between dates on the same line with condition.

Hello. I need to calculate the difference between the dates of different applications:

 

Field Application  Date
P1  1st01/01/2024
P2  1st01/05/2024
P1  2nd01/20/2024
P2  2nd01/22/2024
P1  3rd02/10/2024
P2  3rd02/11/2024
P1  1st02/15/2024
P2  1st02/15/2024
P1  2nd02/27/2024
P2  2nd02/28/2024
P1  3rd03/10/2024
P2  3rd03/11/2024
P1  1st03/14/2024
P2  1st03/16/2024
P1  2nd03/20/2024
P2  2nd03/24/2024
P1  3rd04/02/2024

P2

  3rd

04/05/2024


I need a column or measure to calculate the difference in date averages from different applications of the same Field. For example, the difference between the average dates of the 2nd Application and 1st Application of Field P1, the difference between the average dates of the 3rd Application and 2nd Application of Field P1, and so on for all Fields.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

Column = if(ISBLANK(CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Field]=EARLIER(Data[Field])&&Data[Date]<EARLIER(Data[Date])))),BLANK(),1*(Data[Date]-CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Field]=EARLIER(Data[Field])&&Data[Date]<EARLIER(Data[Date])))))

hope this helps.

Ashish_Mathur_0-1720051542973.png

 


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

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

Column = if(ISBLANK(CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Field]=EARLIER(Data[Field])&&Data[Date]<EARLIER(Data[Date])))),BLANK(),1*(Data[Date]-CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Field]=EARLIER(Data[Field])&&Data[Date]<EARLIER(Data[Date])))))

hope this helps.

Ashish_Mathur_0-1720051542973.png

 


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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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