How to rename a column using DAX in Power BI?

0 votes
Is it possible to rename a column using DAX in Power BI? Can someone explain with example.
Aug 21 in Power BI by ramya
299 views

1 answer to this question.

0 votes

Hi Ramya,

I found these two function that can be used to rename columns.

Table.RenameColumns()

Similar to selectcolumns() takes table, ([old column name],[New column name])

Syntax: 

Table.RenameColumns(table as table, renames as list, optional missingField as nullable number) as table

Ex:

Table.RenameColumns(Table.FromRecords({[CustomerNum=1, Name="Bob", Phone = "123-4567"]}), {"CustomerNum", "CustomerID"})

I took the examples from Power BI docs, refer here for more information on table.renamecolumns().

https://docs.microsoft.com/en-us/powerquery-m/table-renamecolumns

One more shortcut is to use SELECTCOLUMNS( )

It is used to add calculated columns to the table, you can provide an alias name while using selectcolumns(). 

Syntax: 

SELECTCOLUMNS(<table>, <name>, <scalar_expression> [, <name>, <scalar_expression>]…)

In the above syntax, the name is the renamed column name and expression can be given as existing column or any expression.

Ex: 

SELECTCOLUMNS (
    Products,
    "Full Name", Products[full_name],
    "Last Name", Products[last_name]
)
answered Aug 21 by anonymous
• 31,840 points

Related Questions In Power BI

0 votes
1 answer

How to sum a data table in Power BI?

It's a good practice if you avoid ...READ MORE

answered May 17 in Power BI by Avantika
• 1,500 points

edited May 17 by Omkar 93 views
0 votes
1 answer

How to use a gateway in Power Bi?

Follow the below procedure - 1. Install ...READ MORE

answered Oct 29 in Power BI by rachael
14 views
0 votes
1 answer

Is there a way to convert JSON data to readable table in power bi

Follow these steps step 1 - Click on ...READ MORE

answered Sep 24, 2018 in Power BI by Hannah
• 16,300 points
2,869 views
0 votes
1 answer

How to assign Power BI license to a new user

The assign license method of MS Graph API might ...READ MORE

answered Sep 25, 2018 in Power BI by Kalgi
• 42,330 points
67 views
+3 votes
2 answers

Combine tables in Power BI

You can also achieve this using a ...READ MORE

answered Oct 5, 2018 in Power BI by lina
• 8,110 points

edited Oct 11, 2018 by Kalgi 212 views
0 votes
1 answer

Power Bi Dax Table

You need to wrap the numbers in ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 42,330 points
102 views
0 votes
2 answers

Power BI Dax Multiple IF AND Statements

HI I have Column Patient 12 13 14 15 18 IN Patient=12, 13 Out ...READ MORE

answered May 22 in Power BI by VNK
8,981 views
0 votes
1 answer

Distinct count filtered by condition using Power BI Dax

Try this, it should work: DistinctCountActiveMonths = CALCULATE( ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 42,330 points
8,725 views
0 votes
1 answer

How to Install Power BI in Windows

Hi, Anitha Go to this Link https://powerbi.microsoft.com/en-us/downloads/ Then click on ...READ MORE

answered Feb 28 in Power BI by Cherukuri
• 31,840 points
42 views
0 votes
1 answer

How to create final table based on Joins of two tables in power BI?

Hi Nithin, It is easy and simple. 1. Go ...READ MORE

answered Mar 1 in Power BI by Cherukuri
• 31,840 points
270 views