cancel
Showing results for
Did you mean:
Resolver II

## CREATE A TABLE DEPENDING ON A IF

HI,

i have multiple user and depends on the role i want to show some columns or others (a dynamic table depend on a if )

example

table 1

column a, column b, column c, clumn d, column e.

roles

1

2

new calculate table

if( roles = 1 then (create table with columns 'table1' column a, column d, column e ) else if(roles = 2 then  (create table with columns table1 column a, column b, column c) else blank

Regards

1 ACCEPTED SOLUTION
Community Support

Please kindly check whether you'd like to get below results:

1.  I created a Table with column A&B&C&D&E, and another table with only one column as slicer:

2. Then use below measures to generate the output

``field1 = SWITCH([Selected],"1",Max('Table'[B]),"2",Max('Table'[D]))``
``field2 = SWITCH([Selected],"1",Max('Table'[C]),"2",Max('Table'[E]))``

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

Please kindly check whether you'd like to get below results:

1.  I created a Table with column A&B&C&D&E, and another table with only one column as slicer:

2. Then use below measures to generate the output

``field1 = SWITCH([Selected],"1",Max('Table'[B]),"2",Max('Table'[D]))``
``field2 = SWITCH([Selected],"1",Max('Table'[C]),"2",Max('Table'[E]))``

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

Hi @santiagomur ,

assuming you want to display this table of yours in the report canvas, you can't change the columns based on user id. You can try to use measures to show different values for each role, but you will not be able to change column names.

Or have different pages in your report, for each of your roles.

Cheers,
Sturla

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Ted's Dev Camp - January 26, 2023

This session will provide guidance and teach campers the skills required to build Power BI reports that support multiple languages.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### 2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors