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
37,101 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]
)

Preparing for Power BI exam? Check out Power BI Course now!

answered Aug 22, 2019 by anonymous
• 33,030 points

edited Dec 31, 2021 by Soumya

Related Questions In Power BI

0 votes
1 answer

Using DAX calculation how to calculate monthly budget till today in power bi Desktop?

You can make use of this: MTD Budget ...READ MORE

answered Sep 24, 2020 in Power BI by Gitika
• 65,770 points
1,851 views
0 votes
1 answer

How to create a Measure using Power BI DAX?

The following steps make your task simple ...READ MORE

answered Oct 27, 2020 in Power BI by Gitika
• 65,770 points
1,041 views
0 votes
1 answer

How to convert eight digit yyyymmdd to date using DAX in Power BI ?

You can go through this: column = IFERROR( ...READ MORE

answered Dec 8, 2020 in Power BI by Gitika
• 65,770 points
4,231 views
0 votes
1 answer

How to parse a .json column in Power BI?

Use Json.Document function like this let ...READ MORE

answered Dec 21, 2020 in Power BI by Gitika
• 65,770 points
2,937 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,220 points

edited Oct 11, 2018 by Kalgi 2,479 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
• 52,350 points
1,170 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 23, 2019 in Power BI by VNK
18,958 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
• 52,350 points
37,668 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
• 33,030 points
1,078 views
0 votes
3 answers

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

To do so, follow these steps: From the ...READ MORE

answered Dec 16, 2020 in Power BI by Gitika
• 65,770 points
56,038 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP