cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Highlighted
Regular Visitor

Re: Formating date

Thank you for your help.

 

After some iterations it worked 

 

Carsten

View solution in original post

4 REPLIES 4
Highlighted
Anonymous
Not applicable

Re: Formating date

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.

Highlighted
Microsoft
Microsoft

Re: Formating date

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

 

Highlighted
Regular Visitor

Re: Formating date

Thank you for your help.

 

After some iterations it worked 

 

Carsten

View solution in original post

Highlighted
Microsoft
Microsoft

Re: Formating date

Hi @carrussen,

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

Best Regards,
Angelia

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors