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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
santiagomur
Resolver II
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
v-diye-msft
Community Support
Community Support

Hi @santiagomur 

 

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:

0001.PNG0002.PNG

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]))

0003.PNG

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.

View solution in original post

2 REPLIES 2
v-diye-msft
Community Support
Community Support

Hi @santiagomur 

 

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:

0001.PNG0002.PNG

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]))

0003.PNG

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.
sturlaws
Resident Rockstar
Resident Rockstar

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

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors