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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

Expand columns with new columns

Good morning BI experts!

I have a question that has to be easy to resolve.

The database I start from is already established and I can't change it. They are the hours worked per project and represented in a matrix way.

I have created a very simple example, in which we are only going to play with two years (20 and 21) and with the names of projects (A,B,C,D,...)

I have 1 tab per year.

LEJ_1-1634812368389.png

Table year 2021:

LEJ_2-1634812390353.png

In power Query, in the step of expanding columns, these projects are successfully expanded, as this is the first time I expand them:

LEJ_4-1634812668364.png

In the year 2022 and beyond, there will be projects that are closed and therefore there are no columns for them, and new projects will arise:

LEJ_3-1634812481052.png

But these projects don't work out for me. If I go to the step of expanding columns, I see that they are not selected.

LEJ_5-1634813166111.png

Therefore I select them and the data is updated correctly.

LEJ_6-1634813205769.png

But I can't be every time there's a new project selecting all the projects.

Is there a way I won't be deselected for new projects?

Thanks a lot!

Greetings,

Javier

1 REPLY 1
mahoneypat
Employee
Employee

You can use Table.ColumnNames(#"Added Custom") to dynamically get the names of the column headers to expand in place of the hard coded values {"A", "B", ...}.  You may need to use one of the List Functions to get just a subset of those columns, if you see duplicates.

 

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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