Forum Discussion

taylorb's avatar
taylorb
Helper I
5 years ago
Solved

Creating a Dynamic Matrix Based on Column Names in Every Table

I have several reports using Roles to hide sensitive date. Each table with the sensitive data contains a column with the customer name called "CustomerSource" so only that customer should see the inf...
  • v-robertq-msft's avatar
    5 years ago

    Hi, taylorb 

    According to your description, I guess you want to get a table that displays the [CustomerSource] column in the five tables, and the value should be the user who views this report. I think you can not achieve this in a simple DAX, you can create measures for each table to get the expected result, you can take a look at my steps:

    1. Create the five measures in five tables (one by one):
    Table1 = CALCULATE(MAX('Table1'[CustomerSource]),FILTER('Table1',[CustomerSource]=USERPRINCIPALNAME()))
    
    Table2 = CALCULATE(MAX('Table1'[CustomerSource]),FILTER('Table2',[CustomerSource]=USERPRINCIPALNAME()))
    
    Table3 = CALCULATE(MAX('Table1'[CustomerSource]),FILTER('Table3',[CustomerSource]=USERPRINCIPALNAME()))
    
    Table4 = CALCULATE(MAX('Table1'[CustomerSource]),FILTER('Table4',[CustomerSource]=USERPRINCIPALNAME()))
    
    Table5 = CALCULATE(MAX('Table1'[CustomerSource]),FILTER('Table5',[CustomerSource]=USERPRINCIPALNAME()))

     

    1. Create a table chart and place them into it, and view as a username, you can get what you want, like this:

     

    You can download my test pbix file here

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

     

    Best Regards,

    Community Support Team _Robert Qin

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