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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
Microsoft Employee
Microsoft 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
Community Champion
Community Champion

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



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.