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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
esquiveljc
Helper I
Helper I

How to change column names by row values from another column?

Hello,
I have the column names in rows. Let me explain: Column1 must be replaced by the only value in Agg1 therefore "Country", Column2 must be replaced by the only value in Agg2 therefore "Cities" and so on.

 

Column1Column2Column3Agg1Agg2Agg3
United StatesMiami483395CountryCitiesPopulation
United StatesNew York8804190CountryCitiesPopulation
United StatesLos Angeles3971883CountryCitiesPopulation
United StatesChicago2720546CountryCitiesPopulation
United StatesSeattle737015CountryCitiesPopulation
United StatesSan Francisco864816CountryCitiesPopulation
United StatesBoston696959CountryCitiesPopulation
United StatesHouston2296224CountryCitiesPopulation
United StatesPhiladelphia1603797CountryCitiesPopulation
United StatesDallas1300092CountryCitiesPopulation
United StatesPhoenix1608139CountryCitiesPopulation
CanadaVancouver600000CountryCitiesPopulation
CanadaMontreal1600000CountryCitiesPopulation
CanadaCalgary1019942CountryCitiesPopulation
CanadaQuebec528595CountryCitiesPopulation
CanadaToronto2600000CountryCitiesPopulation
CanadaWinnipeg632063CountryCitiesPopulation
CanadaOttawa812129CountryCitiesPopulation
CanadaEdmonton712391CountryCitiesPopulation
CanadaHalifax359111CountryCitiesPopulation
CanadaHamilton519949CountryCitiesPopulation
CanadaRegina176183CountryCitiesPopulation
FranceMarseille794811CountryCitiesPopulation
FranceParis2138551CountryCitiesPopulation
FranceBordeaux231844CountryCitiesPopulation
FranceLyon472317CountryCitiesPopulation
FranceNice338620CountryCitiesPopulation
FranceStrasbourg274845CountryCitiesPopulation
FranceToulouse433055CountryCitiesPopulation
FranceLille228328CountryCitiesPopulation
FranceNantes277269CountryCitiesPopulation
FranceDijon149782CountryCitiesPopulation
FranceAmiens143086CountryCitiesPopulation

 

The goal is to put the correct names of the axes and the legend without hardcoding it.

 

2022-07-07_09-52-55.png

 

I saw that you can't do this via DAX: 

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Change-column-header-names-dynamically-in-a-t...

Do you know if there is another way to do this please?

Thanks

 

1 ACCEPTED SOLUTION
esquiveljc
Helper I
Helper I

The only way I've found is to eliminate the two axis names in Power BI and replace them with a visual card.

 

2022-07-07_14-07-15.png

View solution in original post

3 REPLIES 3
esquiveljc
Helper I
Helper I

The only way I've found is to eliminate the two axis names in Power BI and replace them with a visual card.

 

2022-07-07_14-07-15.png

Anonymous
Not applicable

@esquiveljc you can rename the column name 1,2& 3 as Country , Cities and Populations respectively in power query mode (Transform Data ) 

@AnonymousThanks for your quick response, but as written in my post I can't hardcode because the Country, Cities and Population column names may change in the datasource.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.