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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Calculated column for date comparison

Hello,

I have the folllowing table and i am trying to add a calculated column with output based on:

1. If Start date <= End date, output: Valid dates

2. If Start date > End date, output: Invalid dates

3. If Start date and/or End date missing, output: Missing date/s

Any help is much appreciated!

Student nameStart dateEnd date
Zagrodno01/01/202131/12/2021
Luntas  
Gangarampur01/01/202131/12/2021
Luntas 31/12/2021
Frei Paulo01/01/202131/12/2021
Zagrodno01/01/202131/12/2021
Bellegarde01/08/202130/06/2022
Cosamaloapan de Carpio01/08/202130/06/2022
Seedorf01/08/2021 
Gangarampur01/08/202131/01/2022
Peter Yuan20/09/202231/12/2021
Rea Dorf  
Jin Sand19/09/202101/02/2021
Clive Barker16/11/202116/12/2021
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1666182737975.png

 

 

Status CC =
SWITCH (
    TRUE (),
    ISBLANK ( Data[Start date] ) || ISBLANK ( Data[End date] ), "Missing dates",
    Data[Start date] > Data[End date], "Invalid dates",
    Data[Start date] <= Data[End date], "Valid dates"
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Thennarasu_R
Responsive Resident
Responsive Resident

Check This one

Calculated Column=IF(Start date <= End date,"Valid dates",
IF(Start date > End date,"Ivalid Dates",IF(And(Start date=Blank(), End date=Blank()),
OR(Start date=Blank(), End date=Blank())

Anonymous
Not applicable

@Jihwan_Kim Thank you for your reply! I am trying to add a Card visualization to show the total number of Invalid dates and Missing dates. I tried to use the calculated column directly but i am not sure how to filter and show the Invalid and Missing dates only. Any idea how to do this?

MakeItReal_0-1666199757259.png

 

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1666235032597.png

 

 

Count invalid or missing: =
CALCULATE (
    COUNTROWS ( Data ),
    Data[Status CC] IN { "Invalid dates", "Missing dates" }
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1666182737975.png

 

 

Status CC =
SWITCH (
    TRUE (),
    ISBLANK ( Data[Start date] ) || ISBLANK ( Data[End date] ), "Missing dates",
    Data[Start date] > Data[End date], "Invalid dates",
    Data[Start date] <= Data[End date], "Valid dates"
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors