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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
GustavoV1
Frequent Visitor

How can I create this columns

Hi 

I have a table which have a column for an item and any columns (cost by year) as years I have

 

How can I resume this table to one which has one column for item a four columns after, one for all estimated costs, other for costs before 2020, one for costs in 2020 and other for cost after 2020.

 

Thanks

ColumnasAFilas1.jpgColumnasAFilas2.jpg

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You should be able to do these steps in the query editor to get that result.

 

1. Click on the Items column and right click and choose unpivot other columns

2.Add a custom column with nested if... then... else to add your <2020, 2020, and >2020 based on the year value in the Attribute column

3. Pivot that new column, choosing a sum aggregation on the Value column

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

1 REPLY 1
mahoneypat
Microsoft Employee
Microsoft Employee

You should be able to do these steps in the query editor to get that result.

 

1. Click on the Items column and right click and choose unpivot other columns

2.Add a custom column with nested if... then... else to add your <2020, 2020, and >2020 based on the year value in the Attribute column

3. Pivot that new column, choosing a sum aggregation on the Value column

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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