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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
nijos
Frequent Visitor

Calculated column to find lowest date with a filter on status value per ordernumber

I have this table with date, status and ordernumber.

 

DateStatusOrderNumber
01/01/2024101000
01/02/2024201000
01/03/2024301000
01/04/2024301000
01/05/2024401000
01/06/2024501000
01/01/2025101100
01/02/2025201100
01/06/2025301100
01/04/2025301100
01/05/2025301100
01/06/2025501100

 

For each OrderNumber, I want to find the first date that is on a row with status 30.

In a calculated column, that row must get a 1, the other rows should get a 0.

 

DateStatusOrderNumberCalculated Column
01/01/20241010000
01/02/20242010000
01/03/20243010001
01/04/20243010000
01/05/20244010000
01/06/20245010000
01/01/20251011000
01/02/20252011000
01/06/20253011000
01/04/20253011001
01/05/20253011000
01/06/20255011000

 

Thank you for your help on this.

1 ACCEPTED SOLUTION
nijos
Frequent Visitor

Calculated Column =
VAR CurrentOrder = 'Table'[OrderNumber]
VAR FilteredTable =
    FILTER ( 'Table', 'Table'[Status] = 30 && 'Table'[OrderNumber] = CurrentOrder )
VAR Result =
    CALCULATE ( MIN ( 'Table'[Date] ), FilteredTable )
RETURN
    IF ( Result = 'Table'[Date], 1, 0 )

View solution in original post

1 REPLY 1
nijos
Frequent Visitor

Calculated Column =
VAR CurrentOrder = 'Table'[OrderNumber]
VAR FilteredTable =
    FILTER ( 'Table', 'Table'[Status] = 30 && 'Table'[OrderNumber] = CurrentOrder )
VAR Result =
    CALCULATE ( MIN ( 'Table'[Date] ), FilteredTable )
RETURN
    IF ( Result = 'Table'[Date], 1, 0 )

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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