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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Is it possible to get correct values from subtracting two date columns formatted as text?

Hey Everyone,

 

I currently have two date columns, however I had to change their format to "text", due to format/value error when I was trying to use the date columns in a IF and OR statement, with text values. However the results I get from trying to find the difference between these two columns is slightly off, not greatly off, but still off e.g. result of 1,283 versus what I should get at 1,252.

 

So, I'm not sure if its possible, but I really hope it is as it will my life much easier ...

 

Thank you in advance,

 

Regards,

 

P

1 ACCEPTED SOLUTION

Hi @Anonymous

 

Try below measure. If it is not your case, please share your sample data for your scenario so that we could help further on it.

Column =
FORMAT ( VALUE ( Table5[Column2] ), "MM/DD/YYYY" )
    - FORMAT ( VALUE ( Table5[Column1] ), "MM/DD/YYYY" )

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may refer to below sample. The two date columns are formatted as text. If it is not your case, please share some data sample and expected output.

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi CheRIE,

 

I've tried this and I am getting the error "Cannot convert value of type text to type date"

Hi @Anonymous

 

Try below measure. If it is not your case, please share your sample data for your scenario so that we could help further on it.

Column =
FORMAT ( VALUE ( Table5[Column2] ), "MM/DD/YYYY" )
    - FORMAT ( VALUE ( Table5[Column1] ), "MM/DD/YYYY" )

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

That worked perfectly, thank you

Greg_Deckler
Super User
Super User

Can you post some sample source data and perhaps some of the calculation formulas that you are using? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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