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
sharonmathew
Helper I
Helper I

IF 4 [Fields] =EARLIER[Fields] Then Return DATEDIFF( Curr Date - Previous Date) Days - need help

 

Hi my usual life saving Folks,

 

i have uploaded a link here which i request help.

the First sheet is Data sheet, and second is results.

i am seeking help to get, the measure which would do,

the below.

IF AIRLINE = EARLIER[AIRLINE]
&& FLIGHTNO = EALIER[FLIGHTNO]
&& DEPARTURE = EARLIER[DEPARTURE]
&& DESTINATION = EARLIER[DESTINATION]
THEN

RETURN

DATEDIFF between (CURRENT DATE, ie. ROW date - PREVIOUS DATE)

thanks.

 

data file link
http://powerpivotforum.com.au/viewtopic.php?f=6&t=1057

2 REPLIES 2
Greg_Deckler
Super User
Super User

EARLIER is typically used in a calculated column context. I think to use it in a measure, you would need to do some kind of SUMMARIZE.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

yes, summary is, 

 

from the table,

                              if all the 4 fields match

                              then

                              we need to find the difference between the dates.

 

Note 1 , other than the 4 fields, there are some more fields which need not be matched.

Note 2, the date difference should be calculated only after table is filtered with 4 field criteria.

 

the date difference is between the current date and its previous occurance.

 

i hope i explained . :))

 

 

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.