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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Mark1234
New Member

Identifying Dates

Hi All,

Wondering if anyone can help me with the error. I am trying to write a if statement that will output the what is already shown, while the fixing the european formatted date. Pleae see below for the data set, the outcome, and the function. I must be missing something, if anyone can help that would be awesome.


Mark1234_0-1651529056125.png 

Mark1234_1-1651529114416.png



Mark1234_2-1651529131749.png

Thanks in advance.

 

 

1 ACCEPTED SOLUTION
HotChilli
Community Champion
Community Champion

The 'Any' datatype isn't a particularly useful one if you can avoid it.

I suspect there's an implicit conversion to date going on for some of the values that have double figures for day but it can't convert the single figure days.

If you can get the column in text format first (quite early in the Steps) (and maybe pad the start for single figure days) you'll have a better chance.

I think you might have to look at the 2nd 'if' clause (it's different than the first) also.

And it might have been better if you had provided the DateStarted column and type since that's the one that's in the formula.

View solution in original post

4 REPLIES 4
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Insert ths statement

 

= Table.AddColumn(Source, "Custom", each if Text.Contains([DateStarted],"/") then Date.From([DateStarted]) else if Text.Contains([DateStarted],"-") then #date(Number.From(Text.Split([DateStarted],"-"){2}),Number.From(Text.Split([DateStarted],"-"){1}),Number.From(Text.Split([DateStarted],"-"){0}))
else null, type date)

 

Thanks, but the statement didn't work for me.

HotChilli
Community Champion
Community Champion

The 'Any' datatype isn't a particularly useful one if you can avoid it.

I suspect there's an implicit conversion to date going on for some of the values that have double figures for day but it can't convert the single figure days.

If you can get the column in text format first (quite early in the Steps) (and maybe pad the start for single figure days) you'll have a better chance.

I think you might have to look at the 2nd 'if' clause (it's different than the first) also.

And it might have been better if you had provided the DateStarted column and type since that's the one that's in the formula.

Thank you, adding the extra step to make the column text works. For some reason it didn't work, maybe I was doing something wrong. 

Sorry about the screen shot, I made a copy of it, so I could put it in a screen shot together.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.