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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Jeffrey_VC
Helper III
Helper III

Datediff with argument

Hello everyone,

 

I looking for some help.

In my dataset I have 1 colum with a "create date" and 2 other colums "current" and "New". (This are serialnumbers.)

When In the table "current" a same number exist in the colum "New" I need to calculate the amount of days between the different days.

Anyone any idea to solve this?

 

Thnx.
Jeffrey

1 ACCEPTED SOLUTION
Kaviraj11
Super User
Super User

Hi,

 

You can try this:

 

  1. Create a Calculated Column for the Matching Serial Numbers: First, create a calculated column to identify the matching serial numbers between the “current” and “new” columns.

    MatchingSerial = 
    IF(
        'Table'[current] IN VALUES('Table'[new]),
        'Table'[current],
        BLANK()
    )
  2. Create a Calculated Column for the Create Date of the Matching Serial Numbers: Next, create a calculated column to get the create date for the matching serial numbers.

    MatchingCreateDate = 
    CALCULATE(
        MAX('Table'[create date]),
        FILTER(
            'Table',
            'Table'[new] = EARLIER('Table'[current])
        )
    )
  3. Create a Calculated Column for the Number of Days Between Dates: Finally, create a calculated column to calculate the number of days between the create dates.

    DaysBetween = 
    DATEDIFF(
        'Table'[create date],
        'Table'[MatchingCreateDate],
        DAY
    )
     



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
Kaviraj11
Super User
Super User

Hi,

 

You can try this:

 

  1. Create a Calculated Column for the Matching Serial Numbers: First, create a calculated column to identify the matching serial numbers between the “current” and “new” columns.

    MatchingSerial = 
    IF(
        'Table'[current] IN VALUES('Table'[new]),
        'Table'[current],
        BLANK()
    )
  2. Create a Calculated Column for the Create Date of the Matching Serial Numbers: Next, create a calculated column to get the create date for the matching serial numbers.

    MatchingCreateDate = 
    CALCULATE(
        MAX('Table'[create date]),
        FILTER(
            'Table',
            'Table'[new] = EARLIER('Table'[current])
        )
    )
  3. Create a Calculated Column for the Number of Days Between Dates: Finally, create a calculated column to calculate the number of days between the create dates.

    DaysBetween = 
    DATEDIFF(
        'Table'[create date],
        'Table'[MatchingCreateDate],
        DAY
    )
     



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@Kaviraj11  thnx this works for me.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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