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
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
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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.