cancel
Showing results for
Did you mean:
Helper III

## Calculated column to compare String & Date

Hi everyone,

Refer to the subject, i have one question on how to make a condition for date that based on day
For example in this case, i have a days column & a date_off column seperately. Days column in text type while date_off column is a date type.

I want to make a condition like, return date_off if days <> "Friday". This column will return date_off for every days except from "Friday". Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Super User I

Hi @New_be ,

I think you can create a calculated column using the below DAX:

column = if(Days = "Friday",DAY_OFF,BLANK())

Aiolos Zhao

Proud to be a Super User!

5 REPLIES 5
Super User I

Hi @New_be ,

I think you can create a calculated column using the below DAX:

column = if(Days = "Friday",DAY_OFF,BLANK())

Aiolos Zhao

Proud to be a Super User!

Super User IV

@New_be , Try like

Weekday =WeekDay Name = FORMAT([Date],"dddd")

if(Weekday = WEEKDAY([Date],2) =5, "DAY_OFF",Blank())

if([Weekday] ="Friday", "DAY_OFF",Blank())

Any Weekday Week

ttps://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Power-BI-Turning/ba-p/1187482

Proud to be a Super User!

Microsoft

Hi @New_be ,

Try this calculated column

``column = IF(Days <> "Friday",DAY_OFF,BLANK())``

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

Microsoft

Hi @New_be ,

Is this problem sloved?
If not, please let me know.

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

Helper III

Sorry i forgot to accept one of the answer as a solution. Thanks for your follow up 😊

Announcements

#### Power Platform Community Conference

Check out the on demand sessions that are available now!

#### Power Platform October Community Highlights

Check out the top community contributors across all of the communities

#### Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors