Forum Discussion

HILGARTH's avatar
HILGARTH
Frequent Visitor
2 years ago
Solved

Counting days between different changes made to a record

To a table a copy of the initial record is added when there was a change. I would like to calculate the days between these changes so that I know how many days passed between the different kinds of ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi HILGARTH,

    May I ask if this is the expected output you are looking for? Based on your description, I calculated days between Status Ordered and Shipped and Shipped and Delivered, The following table shows the effect of the display.

     

     

     

    Step: Create a new Calculated column, and drag the new Calculated column to the table visual.

    Column =
    
    DATEDIFF (
    
        CALCULATE (
    
            MAX ( 'Table'[Date of last change] ),
    
            FILTER (
    
                ALL ( 'Table' ),
    
                EARLIER ( 'Table'[Date of last change] ) > 'Table'[Date of last change]
    
                    && 'Table'[Record ID] = EARLIER ( 'Table'[Record ID] )
    
            )
    
        ),
    
        'Table'[Date of last change],
    
        DAY
    
    )

     

    If this does not work, could you please share some sample data without sensitive information and expected output.
    How to provide sample data in the Power BI Forum - Microsoft Fabric Community

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum