Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
xanhdieu
Regular Visitor

Summarizecolumns with rename of column

I want to rename the column to something else with DAX below. 

 

the cntry_code column to "Country Name".

 

EVALUATE
    SUMMARIZECOLUMNS (
        OPTMZ_GRP[cntry_code],
        "column a", SUM ('hcec_sales'[total_sales] )
    )

I've tried the addsolumns but that gave me 2 of the same columns.

 

EVALUATE
 ADDCOLUMNS(
    SUMMARIZECOLUMNS (  
        OPTMZ_GRP[cntry_code],
        ),
        "total_sales", SUM ('hcec_sales'[total_sales] )
    ),
    "Country Name", OPTMZ_GRP_BR_CURR_AIRPT[cntry_iso_cde]
)

cntry_code | total_sales | country Name

USA                 $150          USA 

 

is there a way to rename the column with just one column display?

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @xanhdieu,

 

I think SELECTCOLUMNS function will suitable for your requirement, it support to extract specific columns and rename them at same time.

New Table =
SELECTCOLUMNS (
    SUMMARIZECOLUMNS (
        OPTMZ_GRP[cntry_code],
        "total_sales", SUM ( 'hcec_sales'[total_sales] )
    ),
    "Country Name", [cntry_code],
    "total sales", [total_sales]
)

SELECTCOLUMNS Function (DAX)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

HI @xanhdieu,

 

I think SELECTCOLUMNS function will suitable for your requirement, it support to extract specific columns and rename them at same time.

New Table =
SELECTCOLUMNS (
    SUMMARIZECOLUMNS (
        OPTMZ_GRP[cntry_code],
        "total_sales", SUM ( 'hcec_sales'[total_sales] )
    ),
    "Country Name", [cntry_code],
    "total sales", [total_sales]
)

SELECTCOLUMNS Function (DAX)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thanks!   This works ... though for a few minutes I thought it didn't.   When I first changed a field name, it gave me an error about the field name I just changed.  But that was because the old field name was in the ORDER BY clause  (it was auto-generated DAX).    Mentioning it so I see this when I hit this error again next year 🙂

If I have another table of  'old column name', 'new column name'  how can I use that to rename a column?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.