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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
nytram6
Regular Visitor

PowerBI Dataset Query in Excel (Column rename)

Hi,

 

Hoping somebody can help assist with the renaming of column headers when querying a PowerBI dataset in Excel. 

 

I can live query my required PowerBI dataset in Excel but the column headers are rendered as per the absolute column name (Table[ColumnName]).

 

My live query looks like this:

DEFINE
	VAR __DS0Core = 
		SUMMARIZE(
			'Append1',
			[Description],
			[Variant Code],
			[Main Supplier],
			[Supplier]
		)

	VAR __DS0PrimaryWindowed = 
		TOPN(
			501,
			__DS0Core,
			[Variant Code],
			0,
			[Description],
			1,
			[Main Supplier],
			1,
			[Supplier],
			1
		)

EVALUATE
	__DS0PrimaryWindowed

ORDER BY
	[Variant Code] DESC,
	[Description],
	[Main Supplier],
	[Supplier]

 

Then excel returns column header names:

Screenshot 2024-01-11 102741.png

 

Is there a way to rename this column headers, in the DAX query, to "Description", "Variant Code", "Main Supplier" and "Supplier".

 

Thanks in advance. 

1 REPLY 1
amustafa
Solution Sage
Solution Sage

I believe SELECTEDCOLUMNS function can rename your columns. Give this a try...

 

DEFINE
VAR __DS0Core =
SUMMARIZE(
'Append1',
[Description],
[Variant Code],
[Main Supplier],
[Supplier]
)

VAR __DS0PrimaryWindowed =
TOPN(
501,
__DS0Core,
[Variant Code],
0,
[Description],
1,
[Main Supplier],
1,
[Supplier],
1
)

EVALUATE
SELECTCOLUMNS(
__DS0PrimaryWindowed,
"Description", [Description],
"Variant Code", [Variant Code],
"Main Supplier", [Main Supplier],
"Supplier", [Supplier]
)

ORDER BY
[Variant Code] DESC,
[Description],
[Main Supplier],
[Supplier]

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.