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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
New_be
Helper IV
Helper IV

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

q_1.PNG

1 ACCEPTED SOLUTION
AiolosZhao
Memorable Member
Memorable Member

Hi @New_be ,

 

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

 

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

 

Please try.

Aiolos Zhao





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
V-lianl-msft
Community Support
Community Support

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.

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.

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

amitchandak
Super User
Super User

@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

AiolosZhao
Memorable Member
Memorable Member

Hi @New_be ,

 

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

 

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

 

Please try.

Aiolos Zhao





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.