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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Jays_D
Advocate I
Advocate I

Swapping sets of columns in a table based on role type

Hi Everyone,

 

I have a parameter in Power BI which is for a Role type. Based on the role you select, it replaces the role column in a table with the relevant role selected.

 

What I am trying to do is, based on the role selected, it will also insert a number of other relevant columns into the table.

Example:
If Role 1 is selected, also insert columns:

Role 1 Start Date 

Role 1 Rework Date

Role 1 End Date

 

If Role 2 is selected:

Role 2 Start Date

Role 2 Rework Date

etc

 

Admittedly, I am very new to Power BI, but have searched for this scenario on the internet and cannot find a solution.

 

 

1 ACCEPTED SOLUTION

Hi @Jays_D ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1688692964269.png

Please try:

First create a field parameter:

vjianbolimsft_1-1688693143235.png

Then add a new column to the parameter table:

vjianbolimsft_2-1688693319435.png

Then use the 'Role' column to create a slicer:

vjianbolimsft_3-1688693398261.png

Final output:

vjianbolimsft_4-1688693413270.png

vjianbolimsft_5-1688693423152.png

Best Regards,

Jianbo Li

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

View solution in original post

6 REPLIES 6

Greatly appreciate your response @amitchandak . Let me try to explain, the articles above don't cover what I am hoping to achieve.

I have the following columns:

Role 1 Name

Role 1 Start Date

Role 1 Rework date

Role 1 End Date

 

Role 2 Name

Role 2 Start Date

Role 2 Rework date

Role 2 End Date

 

Role 3 Name

Role 3 Start Date

Role 3 Rework date

Role 3 End Date

 

I have a Parameter already setup called "Roles" which consists of:

Role 1 Name

Role 2 Name

Role 3 Name

 

This Parameter I have as a column in my table so whenever I select (for example) Role 1, the "Role" column in my table only shows Role 1 Name.

 

What I want to do is:

When I select "Role 1" I also want it to show in the table:

Role 1 Start Date

Role 1 Rework date

Role 1 End Date

Hi @Jays_D ,

 

Is your data Role1 xxxx one column of data or two columns of data?

vjianbolimsft_0-1688625907321.pngvjianbolimsft_1-1688626057962.png

Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

Please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

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

Thanks for the response @v-jianboli-msft .

Each is it's own column. Example

Role 1 NameRole 1 Start DateRole 1 Rework DateRole 1 End DateRole 2 NameRole 2 Start DateRole 2 Rework  Date

Role 2 

End Date

Role 3 Nameetc

 

How I envision this working, is a parameter which has Role 1, Role 2, Role 3 etc

 

If I select Role 1 in the Parameter it adds to my table:

Role 1 NameRole 1 Start DateRole 1 Rework DateRole 1 End DateStatic ColumnStatic ColumnStatic ColumnStatic ColumnStatic ColumnStatic Column

 

Then, perhaps I select Role 2 in my Parameter which then swaps out the relevant columns in my table:

Role 2 NameRole 2 Start DateRole 2 Rework DateRole 2 End DateStatic ColumnStatic ColumnStatic ColumnStatic ColumnStatic ColumnStatic Column

 

I'd like to avoid sample data sets if I can as I am very new to Power BI and work in a Financial Institution, I am just not at a comfortable level - I do apologies.

Hopefully the above will paint a clearer picture? Thank you so much again for taking the time to respond.

Hi @Jays_D ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1688692964269.png

Please try:

First create a field parameter:

vjianbolimsft_1-1688693143235.png

Then add a new column to the parameter table:

vjianbolimsft_2-1688693319435.png

Then use the 'Role' column to create a slicer:

vjianbolimsft_3-1688693398261.png

Final output:

vjianbolimsft_4-1688693413270.png

vjianbolimsft_5-1688693423152.png

Best Regards,

Jianbo Li

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

Thank you @v-jianboli-msft !
This is precisely what I was looking for ! Truly appreciate this, has solved a majot bug bear for me !

Apologies for the late response.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.