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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Resolver I

## Converted Date Field (Incorrect Day Showing)

I converted source data field (yyyymmdd) "ACEFDT" using the following formula to create a calculated column to show (mm/dd/yyyy).  The calculated column show the year and month as being corrcet, but the day is not corrcet.  I'm not sure if it's my calculation or how the source field is structured. Any help would be great. Thanks in advance!

Formula:  Effective Date = DATE(LEFT(AISCVGP[ACEFDT],4),MID(AISCVGP[ACEFDT],5,2),LEFT(AISCVGP[ACEFDT],2))

Source Date Field (ACEFDT)

Source data field "ACEFDT" Format and Data Type are set as "Text"

Calculated Column Field (Effective Date)

1 ACCEPTED SOLUTION
Resolver I

I was able to resolve my date issue. The below process was  used in power query. Thanks again for your insights.

1) Changed source field to TEXT
2) Created a custom column and used M-code // Text.BeforeDelimiter([ACEFDT], " ")) //
3) Changed new column to Date format

7 REPLIES 7
Solution Sage

Try this:

Effective Date = DATE(LEFT(AISCVGP[ACEFDT],4),MID(AISCVGP[ACEFDT],5,2),RIGHT(AISCVGP[ACEFDT],2))

Resolver I

Thanks for the reply.  Unfortunately the formaula is not working for me.

Solution Sage

Sorry about that.  How about this?

``````Effective Date =
DATE(
VALUE( LEFT( AISCVGP[ACEFDT], 4) ),
VALUE( MID( AISCVGP[ACEFDT], 5, 2) ),
VALUE( RIGHT( AISCVGP[ACEFDT], 2) )
)``````

Resolver I

I was able to resolve my date issue. The below process was  used in power query. Thanks again for your insights.

1) Changed source field to TEXT
2) Created a custom column and used M-code // Text.BeforeDelimiter([ACEFDT], " ")) //
3) Changed new column to Date format

Super User

The formula is incorrect. Check the last section.

However, this will convert to a date in Power Query simply by changing the type (i.e. without the convoluted formula)

Resolver I

I was able to resolve my date issue. The below process was  used in power query. Thanks again for your insights.

1) Changed source field to TEXT
2) Created a custom column and used M-code // Text.BeforeDelimiter([ACEFDT], " ")) //
3) Changed new column to Date format

Resolver I

Thanks for the reply. I'm entirely sure what the best method is to convert the date field in power query, but I tried to convert the field to a text then changing back to a date field in power query and that's did not work for me.

## Helpful resources

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors