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, 2019 in Power BI by ramya
917 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, 2019 by anonymous
• 32,420 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, 2019 in Power BI by Avantika
• 1,500 points

edited May 17, 2019 by Omkar 142 views
0 votes
1 answer

How to use a gateway in Power Bi?

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

answered Oct 29, 2019 in Power BI by rachael
35 views
+1 vote
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
• 17,330 points
3,465 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
• 49,340 points
84 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,180 points

edited Oct 11, 2018 by Kalgi 270 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
• 49,340 points
133 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, 2019 in Power BI by VNK
10,373 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
• 49,340 points
10,812 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, 2019 in Power BI by Cherukuri
• 32,420 points
59 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, 2019 in Power BI by Cherukuri
• 32,420 points
697 views