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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
paulhazelwood
New Member

Return date calculation based on text

I have a text column with values and then a date column. What i am trying to do is if the text column contains a certain word, then calculate the date difference between the date and today. If the text column has a different word, then I do not need the calculation.

1 ACCEPTED SOLUTION

Hi @paulhazelwood ,

 

Please try:

Column = IF(ISBLANK(SEARCH("Hold",'Table'[Value],,BLANK())),BLANK(),DATEDIFF('Table'[Date],TODAY(),DAY))

vcgaomsft_0-1676269796500.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

5 REPLIES 5
Thennarasu_R
Responsive Resident
Responsive Resident

Hi @paulhazelwood 
Date Column Do you have Seperate columnb or not?
Can you share the  any Ex Pic?

Thanks,
Thennarasu

Sorry unable to provide screenshot, but if you picture a column with dates (column A) and a column with text values (column B). What I want is a 3rd column that if Column B contains "word" then calculate datediff between date in Column A and TODAY.

Hi @paulhazelwood 
Could you use this Calculation,

I hope this will help to you

Thennarasu_R_0-1676010144372.png


Thanks ,
Thennarasu

Thanks for the reply however not quite what I am after. I have the date column and then a text column which would contain different values, such as "Hold", "Action", "Reply" etc.
If the text colum contains the word "Hold" then in the 3rd column give me the date diff between the date column and today. If it is any other word then give me NULL.

 

Hi @paulhazelwood ,

 

Please try:

Column = IF(ISBLANK(SEARCH("Hold",'Table'[Value],,BLANK())),BLANK(),DATEDIFF('Table'[Date],TODAY(),DAY))

vcgaomsft_0-1676269796500.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.