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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
liechpa
Regular Visitor

Looking for a end timestamp

Hi folks

I have the following table with the columns "product", "order_nr", "state_start", "from_state", "to_state" and "state".

I want to calculate the column "state_end" which is always the closest timestamp (depending on the column "product", "order_nr" and "from_state").

 

states.PNG

If the status is not left, state_end=state_start.


I hope someone can help me


Thanks

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @liechpa ,

 

To create two calculated columns as below.

final date = IF(ISBLANK('Table'[state_end]),'Table'[state_start],'Table'[state_end])
max date = 
CALCULATE (
    MAX ( 'Table'[final date] ),
    FILTER (
        'Table',
        'Table'[Product] = EARLIER ( 'Table'[Product] )
            && 'Table'[order_nr] = EARLIER ( 'Table'[order_nr] )
            && 'Table'[from_state] = EARLIER ( 'Table'[from_state] )
    )
)

Capture.PNG

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @liechpa ,

 

To create two calculated columns as below.

final date = IF(ISBLANK('Table'[state_end]),'Table'[state_start],'Table'[state_end])
max date = 
CALCULATE (
    MAX ( 'Table'[final date] ),
    FILTER (
        'Table',
        'Table'[Product] = EARLIER ( 'Table'[Product] )
            && 'Table'[order_nr] = EARLIER ( 'Table'[order_nr] )
            && 'Table'[from_state] = EARLIER ( 'Table'[from_state] )
    )
)

Capture.PNG

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
parry2k
Super User
Super User

@liechpa sorry not very clear about your question? There is no status column in your sample data. Could you please put it in sample excel file and also the logic to get end_time with explanation, it will help to get the solution



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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