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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RossC
Frequent Visitor

Date and time formatting

Hi I'm new here and trying to figure out DAX as I go, I have an issue with a Power BI Dashbard that I am trying to create from a downloaded report from an Old system, and I want to be able to refresh the data and let Power BI format the data for me. 

 

 

The report shows the date format as 20180424140009, I need to convert this number to

 

Year 2018,

Month 04 (April),

Day 24th

Hour 14:00

Min 00

Seconds 09

 

I have managed to do this in excel, but I don't really want to have to modify an excel file each time I want to refresh the report.  The Excel formula that works is below and only creates the date.  The time isn't required.

 

This formula only divides up the characters and then Power BI recognises them as a Date.

=TEXT(DATE(LEFT(L2,4),MID(L2,5,2),MID(L2,7,2))+TIME(MID(L2,9,2),MID(L2,11,2),MID(L2,13,2)),"dd/mm/yyyy")

 

Ideal output would be to conver this 20180424140009, to this 24/04/2018 as a Date Hierarchy

 

Thanks in advance for any help

 

Ross

 

 

1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

@RossC

 

The DAX formula in PowerBi will be pretty much the same as the one in Excel.

 

Creata a new column and not measure and add the following code:

 

 

datenew = MID('Table'[DateColumn], 7,2) & "/" & MID('Table'[DateColumn], 5,2) & "/" & LEFT('Table'[DateColumn],4)

 

Then go to Modelling tab on top, select the datenew column and change the data type to Date

View solution in original post

2 REPLIES 2
themistoklis
Community Champion
Community Champion

@RossC

 

The DAX formula in PowerBi will be pretty much the same as the one in Excel.

 

Creata a new column and not measure and add the following code:

 

 

datenew = MID('Table'[DateColumn], 7,2) & "/" & MID('Table'[DateColumn], 5,2) & "/" & LEFT('Table'[DateColumn],4)

 

Then go to Modelling tab on top, select the datenew column and change the data type to Date

Thanks that worked perfectly!!! Smiley Very Happy

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.