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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Difference bewteen Max date and todays date in a data set

Hi Experts

 

I have the following sample data extract as shown..

Canadapvalue.PNG

 

 

 

 

 

 

 

 

i have added the following as a calculated column to the above table

Maxdate =
CALCULATE (
MAX ( DH_AUDITCONTENTIMPORT[Date] ),
ALLEXCEPT ( DH_AUDITCONTENTIMPORT, DH_AUDITCONTENTIMPORT[Product] )
)
 
now i am trying to work out the datediff between the max date less todays() date. which i am have trouble with.

 

1 ACCEPTED SOLUTION

Hi  @Anonymous ,

 

Here's my sample data (the values of my date column are different from yours.):

dd1.PNG

For your problem, I suggest you use measure:

 

Days = 
VAR x = 
CALCULATE(
    MAX([Date]),
    ALLEXCEPT(
        DH_AUDITCONTENTIMPORT,
        DH_AUDITCONTENTIMPORT[Company], DH_AUDITCONTENTIMPORT[Product]
    )
)
RETURN
DATEDIFF(
    x,
    TODAY(),
    DAY
)

 

dd2.PNG

 

Best regards,
Lionel Chen

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

4 REPLIES 4
amitchandak
Super User
Super User

Did not get it completely

Try
Maxdate =

var _1 =CALCULATE (
MAX ( DH_AUDITCONTENTIMPORT[Date] ),
ALLEXCEPT ( DH_AUDITCONTENTIMPORT, DH_AUDITCONTENTIMPORT[Product] )
)
return
datediff(_1, today()-1,Day)

 

Anonymous
Not applicable

Hi Amrit

Lets take company a, and product book the max date is 3/3/2020, so this less todays date show give us 8 days. 

 

Hi  @Anonymous ,

 

Here's my sample data (the values of my date column are different from yours.):

dd1.PNG

For your problem, I suggest you use measure:

 

Days = 
VAR x = 
CALCULATE(
    MAX([Date]),
    ALLEXCEPT(
        DH_AUDITCONTENTIMPORT,
        DH_AUDITCONTENTIMPORT[Company], DH_AUDITCONTENTIMPORT[Product]
    )
)
RETURN
DATEDIFF(
    x,
    TODAY(),
    DAY
)

 

dd2.PNG

 

Best regards,
Lionel Chen

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

 

 

Anonymous
Not applicable

Can you share whats the expected output?

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.