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
Chandramouli_BI
Helper III
Helper III

Extracting last 2 digits from a whole number column which is a date_key column

I have a date_key column which is in the format of 20230401, 20230402,...... 2023 is year, 04 is month & 01,02 ..are days. Tha data type of the date_key column is whole number. I want a new column in my table which consists of only days 01,02,...30/31. How to do? 

1 ACCEPTED SOLUTION
LarryFisherman
Frequent Visitor

Hi,

In Power Query you can create a new column with the days extacted from your original column.

In Power Query go to Transform -> Extract -> Last characters

LarryFisherman_0-1697438594504.png


If you want it in DAX instead, you can also use the LEFT function to get the same result.

View solution in original post

1 REPLY 1
LarryFisherman
Frequent Visitor

Hi,

In Power Query you can create a new column with the days extacted from your original column.

In Power Query go to Transform -> Extract -> Last characters

LarryFisherman_0-1697438594504.png


If you want it in DAX instead, you can also use the LEFT function to get the same result.

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.