Okay, you can do this using either Power Query Editor or DAX (Data Analysis Expressions).
Generally, for static text transformations like this, using Power Query is the preferred method because the transformation happens during data loading, which can be more efficient and keep your data model leaner.
Here are the steps for both methods:
Method 1: Using Power Query Editor (Recommended)
This method adds the column before the data is loaded into your model.
In Power BI Desktop, click on the "Transform data" button in the Home tab. This opens the Power Query Editor.
In the Power Query Editor, select the table you want to add the column to from the "Queries" pane on the left.
Go to the "Add Column" tab in the ribbon.
Click on "Extract".
From the dropdown menu under "Extract", select "Last Characters".
A dialog box will appear:
Select the column you want to extract from in the "Column" dropdown.
Enter 7 in the "Count" box.
Click OK.
A new column will be added to the end of your table containing the last 7 characters of the selected column.
You can rename this new column by double-clicking its header.
Once you're done, go to the "Home" tab and click "Close & Apply" to load the changes into your data model.
Method 2: Using DAX (Creating a Calculated Column)
This method adds the column after the data is loaded into your model as a calculated column.
In Power BI Desktop, go to the "Data" view (the table icon on the left navigation pane) or the "Model" view (the model icon).
Select the table you want to add the column to from the "Data" pane on the right.
Right-click on the table name and select "New column", OR click the "New column" button in the "Table tools" ribbon tab (in Data view) or "Modeling" tab (in Model view).
A formula bar will appear. Enter the following DAX formula:
dax
New Column Name = RIGHT('Your Table Name'[Your Existing Column], 7)
Replace New Column Name with the desired name for your new column.
Replace 'Your Table Name' with the actual name of your table (including single quotes if there are spaces in the name).
Replace [Your Existing Column] with the actual name of the column you want to extract from.
Press Enter to create the column.
Explanation of the DAX Function:
RIGHT(text, num_chars): This DAX function returns the last num_chars from the text string.
Which method to choose?
Use Power Query if this is a static data cleaning or preparation step. It's generally more performant for adding simple, fixed-value columns based on existing ones.
Use DAX if the source column is already a calculated column, or if you are more comfortable with DAX and the performance difference isn't significant for your dataset size.
Both methods will achieve your goal of creating a column with the last 7 letters. Remember that both Text.End (Power Query) and RIGHT (DAX) will gracefully handle cases where the source string is shorter than 7 characters – they will simply return the entire string.