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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Conditional custom column based on dates comparison

Hello,

I have the following table loaded in Power Query. I am trying to add a new column called "Category" which would have specific text values based on the following conditions:

1. If Action date is greater than End date, then display text "Late".

2. If Action date is less or equal to End date, then display text "On time".

3. If Action date is missing (null), then display text "No action".

Any help is much appreciated!

 

Start dateEnd dateAction dateStockReturnsDefective
01/05/202101/06/202201/07/20226917
27/05/202227/06/202227/06/20222510
07/08/202207/09/202207/08/20225615
08/08/202208/09/2022 348
12/08/202220/09/202222/09/20222210
17/08/202227/09/202223/08/20227822
20/08/202210/10/2022 3313
22/08/202202/09/202222/09/20226318
29/08/202209/10/202202/10/20223314
07/09/202217/10/2022 2717
16/09/202206/10/202219/09/20223722
20/10/202223/11/202215/11/20229316
23/11/202202/12/202223/12/20227520
11/12/202215/01/2023 9818
04/01/202304/03/202317/02/20236716
17/02/202313/03/202301/03/202371434

 

Expected results:

Start dateEnd dateAction dateStockReturnsDefectiveCategory
01/05/202101/06/202201/07/20226917Late
27/05/202227/06/202227/06/20222510On time
07/08/202207/09/202207/08/20225615On time
08/08/202208/09/2022 348No action
12/08/202220/09/202222/09/20222210Late
17/08/202227/09/202223/08/20227822On time
20/08/202210/10/2022 3313No action
22/08/202202/09/202222/09/20226318Late
29/08/202209/10/202202/10/20223314On time
07/09/202217/10/2022 2717No action
16/09/202206/10/202219/09/20223722On time
20/10/202223/11/202215/11/20229316On time
23/11/202202/12/202223/12/20227520Late
11/12/202215/01/2023 9818No action
04/01/202304/03/202317/02/20236716On time
17/02/202313/03/202301/03/202371434On time
1 ACCEPTED SOLUTION
davehus
Memorable Member
Memorable Member

Hi @Anonymous ,

 

Try the custom column below.

 

if [Action date] = null then "No Action" else if [Action date] > [End date] then "Late" else if [Action date] <= [End date] then "On Time" else "No Action"

 

Did I help you today? Please accept my solution and hit the Kudos button.

View solution in original post

1 REPLY 1
davehus
Memorable Member
Memorable Member

Hi @Anonymous ,

 

Try the custom column below.

 

if [Action date] = null then "No Action" else if [Action date] > [End date] then "Late" else if [Action date] <= [End date] then "On Time" else "No Action"

 

Did I help you today? Please accept my solution and hit the Kudos button.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors