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
carrussen
Regular Visitor

Formating date

 

Hi

 

I am unsuccesfully trying to convert a date in text format to a date in date format !

 

I have inported the raw date "dd.mm.yyyy" and splitted the the text date up in three colums "dd", "mm" and "yyyy" - see the picture below.

 

My intension was to use the formula in "yellow"! It works fine with hard coded dates - but the formula fails if I change eg. 2016 with [yyyy]

 

Date.JPG

 

 

 

 

 

 

 

 

The funny thing is that I use the same method in another sheet - here it works...

 

The differnce is that formula works when the input file is a CSV-file - but the formula does not work when the input is a Cube...

 

... strange - any suggestion to what the problem could be?

 

Carsten

 

 

1 ACCEPTED SOLUTION

Thank you for your help.

 

After some iterations it worked 

 

Carsten

View solution in original post

4 REPLIES 4
v-huizhn-msft
Employee
Employee

Hi @carrussen,

I reproduce your scenario, input data from Cube, the formula still work. Please see the following screenshot.

1(1).PNG

Please use another method to get date type column using DATE function.

Date=DATE([YYYY],[mm],[dd])


In addition, you can change text to date directly in the data formuting under modeling.

Best Regards,
Angelia

 

Thank you for your help.

 

After some iterations it worked 

 

Carsten

Hi @carrussen,

Congratulations, please mark the right reply as answer. So more people will find the solution easily.

Best Regards,
Angelia

Anonymous
Not applicable

The format of date columns in the data model is not set by your DAX code, but by the options Formatting in Modeling tab of the ribbon at the top of Power BI Desktop interface. You can see that on your screenshot. If the desired format is not on the list in Format option, then you are not able to force a column of date type to be presented the way you want. There is no perfect solution for that, but you can use a calculated text column as a kind of label for dates - then you can use for example FORMAT function available in DAX to change the format as desired.

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.