Comparing Dates w/ Date Time Stamp

Hi all,

I am doing a simple comparison of date with the following measure:

of New Prospects =

Calculate(
Calculate(
COUNTROWS(Prospects),
FILTER(Prospects,
Prospects[Marketing Contact Status]=“true” &&
Prospects[Campaign Member Create Date]=Prospects[Contact Create Date])

))

and I tested the measure in a calculated column

test =
IF(Prospects[Contact Create Date]=Prospects[Campaign Member Create Date],“yes”,“no”)

and what I found out is that both date columns are date/time stamped so if a date in one column shows 4/29//2022 12:00 AM and the other column shows 4/29/12:28:28 AM, the results show “no”, I would like the measure to only look at the mm/dd/yyyyy for its analysis and not the time .

See attached image and thanks for your help.

PPD Prosepcts Report.pbix (27.1 MB)

Hello @ysherriff,

Thank You for posting your query onto the Forum.

As per the recommended best practices, you should split the date/time column into two separate columns i.e., one for Date and another one for Time. By doing so, firstly, you’ll be able to overcome this type of problem. Secondly, when doing time intelligence calculations, you’ll be able to achieve the results correctly and finally but most importantly, it’ll also optimize the file size as well.

Hoping you find this helpful and solves your problem as well.

Thanks and Warm Regards,
Harsh

1 Like

Hi,

You can use format to convert datetime into date before evaluation
Like below

test = 
VAR dt1=Format(Prospects[Contact Create Date],"mm/dd/yyyy")
VAR dt2=Format(Prospects[Campaign Member Create Date],"mm/dd/yyyy")
return
IF(dt1=dt2,"yes","no")

But i agree with @Harsh it will help you in reducing the data size of report also which eventually help in performance.

Thanks

Thank you both. When you mean split date/time or you speaking about changing the Type from Date/Time to Date in Power Query or something else?

Thanks

Hello @ysherriff,

When we say about splitting date/time, it means that bifurcate date in one column and time in another one. It’s different from conversion.

Right now, your column looks like this -

image

Now, split this in the form of date and time. Like this -

image

This is done by using the option of “Split Column” inside the Power Query. See this -

image

Insert “Space” as a delimiter and then it’ll split them in two different column like it’s shown in the above picture where one column contains date and another contains time.

Thanks and Warm Regards,
Harsh

1 Like

Gotcha!!! Perfect. I just saw it on Radcad.com as well.

I appreciate you Harsh… :slight_smile: :smile:

Hello @ysherriff,

You’re Welcome!!! :slightly_smiling_face:

We’re glad that we were able to assist you.

Thanks and Warm Regards,
Harsh