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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
yellow_days
Helper I
Helper I

Format Date which is a string / Using a View

Hello,

 

I have a Date column which is a String . I would like to generate a new column, that shows me the last n days. Therefore I need to convert my Column in a date

 

Im using this code:

Column_NewDate = FORMAT(PIVOT_TABLE[DATES];"DD.MM.YYYY")

 

I get a new column but as soon I create a new column for the last n days, i get a error msg.

Im using following code:

IF(DATEDIFF(PIVOT_TABLE[Column_NewDate ],TODAY(),DAY)>=7, "Yes", "No")

I get the Error Msg that I can not convert "23.10.2017" of Type "Text" into Date

 

I dont know what Iam doing wrong. Is it maybe because Iam using a View?

 

 

 

1 ACCEPTED SOLUTION

Use SUBSTITUTE to replace your "." with "/" before you try DATEVALUE.



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...

View solution in original post

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

Look at the DATEVALUE function. https://msdn.microsoft.com/en-us/query-bi/dax/datevalue-function-dax

 



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...

I get the same Error Msg "You cant convert text to date"

 

I tried following Code:

 

Test = DATEVALUE(PIVOT_TABLE[DATES])

Maybe I should mention that my text date looks like this: DD.MM.YYYY

Use SUBSTITUTE to replace your "." with "/" before you try DATEVALUE.



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...

Hi,

 

There could be one of 2 problems.  Either . is not a recognised date seperator in your Windows Installation or if it is, then may be your systems date format in MM/DD/YYYY.  It could also be both reasons.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.