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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Teena_Pa4
Frequent Visitor

Select columns using column name

Hi,

 

New to Power BI here... I have a table with a column that I need to pivot. After pivoting, I need to sum up several pivoted columns containing a specific keyword in their column names. Could you please advise how to achieve this?

 

Thank you.

5 REPLIES 5
luxpbi
Helper V
Helper V

Could you please share some example data ?

 

Regards

Hi,

 

I have columns like Sales_A, Sales_B, Incentives, Bonus, Sales_C. How can I create a new column to sum up columns where column name contains "Sales"?

 

Thanks.

Hi @Teena_Pa4,

 

Can you sum them up like below?

 

Measure =
SUM ( 'table'[Sales_A] ) + SUM ( 'table'[Sales_B] ) + SUM ( 'table'[Sales_C] )

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

Thank you for your response.

 

My problem is, there can be additional columns having the same prefix "Sales_". How can I dynamically add all columns that starts with "Sales_"?

 

Thanks.

Hi @Teena_Pa4,

 

I'm afraid we can't add columns dynamically. Only the new rows will be included in the calculation automatically. Maybe you can unpivot the data in the Query Editor. Please refer to the snapshot below.

Select-columns-using-column-name

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.