Forum Discussion

Ben_jamin's avatar
Ben_jamin
Frequent Visitor
1 year ago
Solved

Creating a flag using a value and two date fields

Hi Power Bi community, I am hoping to gather some help in creating a flag to identify multiple service orders for a serial number based on contract start and end dates. I find it difficult to phrase...
  • johnt75's avatar
    1 year ago

    You can create a calculated column like

    Multiple service orders in a contract =
    VAR NumOrders =
        CALCULATE (
            COUNTROWS ( 'Table' ),
            ALLEXCEPT (
                'Table',
                'Table'[Serial #],
                'Table'[Contract start date],
                'Table'[Contract end date]
            )
        )
    VAR Result =
        IF ( NumOrders > 1, "Yes", "No" )
    RETURN
        Result