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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

IF Statements

Hi All,

Trying to convert this formula from Excel and Power BI and not too sure how.

=IF([@SNStatus2]="OPEN","Outstanding Due",
IF([@ReceiptDate]<=[@[Due Date]],"On Time","Overdue Completion"))


Tried the following on Power BI but it doesn't work:

IF([SNStatus2]="Open","Open",
IF ([SNStatus2]="Closed","Outstanding Due",
IF([ReceiptDate]<=[Due Date], "On Time", "Overdue Completion")
))
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

In Power BI Desktop, you can create measures or calculated columns.

The formula you provided belong to the calculated column.

Calculated column =
IF (
    [SNStatus2] = "Open",
    "Open",
    IF (
        [SNStatus2] = "Closed",
        "Outstanding Due",
        IF ( [ReceiptDate] <= [Due Date], "On Time", "Overdue Completion" )
    )
)

Here's the measure you can try. We often use MAX function to reference the current row. The MIN function can also be used, and if it is a numeric type, the SUM function can also refer to the current row.

Measure =
IF (
    MAX ( 'TableName'[SNStatus2] ) = "Open",
    "Open",
    IF (
        MAX ( 'TableName'[SNStatus2] ) = "Closed",
        "Outstanding Due",
        IF (
            MAX ( 'TableName'[ReceiptDate] ) <= MAX ( 'TableName'[Due Date] ),
            "On Time",
            "Overdue Completion"
        )
    )
)

 Power BI: Calculated Measures vs. Calculated Columns | by Rod Castor | Towards Data Science

Calculated Column and Measure in Power BI (powerbiconsulting.com)

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

In Power BI Desktop, you can create measures or calculated columns.

The formula you provided belong to the calculated column.

Calculated column =
IF (
    [SNStatus2] = "Open",
    "Open",
    IF (
        [SNStatus2] = "Closed",
        "Outstanding Due",
        IF ( [ReceiptDate] <= [Due Date], "On Time", "Overdue Completion" )
    )
)

Here's the measure you can try. We often use MAX function to reference the current row. The MIN function can also be used, and if it is a numeric type, the SUM function can also refer to the current row.

Measure =
IF (
    MAX ( 'TableName'[SNStatus2] ) = "Open",
    "Open",
    IF (
        MAX ( 'TableName'[SNStatus2] ) = "Closed",
        "Outstanding Due",
        IF (
            MAX ( 'TableName'[ReceiptDate] ) <= MAX ( 'TableName'[Due Date] ),
            "On Time",
            "Overdue Completion"
        )
    )
)

 Power BI: Calculated Measures vs. Calculated Columns | by Rod Castor | Towards Data Science

Calculated Column and Measure in Power BI (powerbiconsulting.com)

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

FreemanZ
Community Champion
Community Champion

what error do you get?

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.