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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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