Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Re-arrange table rows and columns

Hi! I am looking to re-arrange the following table by chnaging rowa and columns as in the example below.   Original data output :   date                 Col 1     Col 2     Col 3 2020/02/02    ...
  • v-gizhi-msft's avatar
    6 years ago

    Hi,

     

    For your requirement, i think it can be easily reached by using matrix visual.

    Here is my test table and calculated columns:

    Col 1 = DATEDIFF('Table'[Date],DATE(2020,2,9),DAY)
    Col 2 = 'Table'[Col 1]*4
    Col 2 = 'Table'[Col 1]*8

    Then please try to create a table by Enter Data as below:

    Then try this measure:

    Measure = 
    SWITCH (
        SELECTEDVALUE ( Category[.] ),
        "Col 1", MAX ( 'Table'[Col 1] ),
        "Col 2", MAX ( 'Table'[Col 2] ),
        "Col 3", MAX ( 'Table'[Col 3] )
    )

    Choose above new column and this measure as a matrix visual, the result shows:

    Here is my test pbix file:

    pbix 

    Hope this helps.

     

    Best Regards,

    Giotto Zhi