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
38 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
• 25,820 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 75 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
• 14,070 points
2,238 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
• 40,440 points
56 views
0 votes
3 answers

How do I get token using javascript API while trying to embed graphs using Power BI

Use ADAL.js that will give you an ...READ MORE

answered Jun 22 in Power BI by anonymous
561 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 170 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
• 40,440 points
79 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
7,469 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
• 40,440 points
6,120 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
• 25,820 points
31 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
• 25,820 points
131 views