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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Adjacent column groups in matrix

I want to make a matrix with with row groups wich are a hierarchy, but the column groups must be adjacent

 

For example, this table

tabel.png

 

 

 

 

 

 

 

 

Must look like this:

Moetzijn.png

 

instead of this:

Fout.png

 

Is this possible with Power BI at this moment?

 

Help is appreciated, Thanks!

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

You can refer to following calculate table formula to create a new table with original table records and summarize table records:

Table =
UNION (
    'Sample',
    SELECTCOLUMNS (
        SUMMARIZE (
            'Sample',
            [Land],
            [Stad],
            [geslacht],
            "leeftijdgroep", [geslacht],
            "Aantal", SUM ( 'Sample'[Aantal] )
        ),
        "Client", BLANK (),
        "Land", [Land],
        "Stad", [Stad],
        "geslacht", [geslacht],
        "leeftijdgroep", [leeftijdgroep],
        "Aantal", [Aantal]
    )
)

After these, you can create a table as custom sort order table to define column order.(you can't direct change sort order of matrix column fields)

Sort Table = 
SELECTCOLUMNS (
    VALUES ( 'Table'[leeftijdgroep] ),
    "leeftijdgroep", [leeftijdgroep],
    "Index", SWITCH (
        [leeftijdgroep],
        "M", 1,
        "V", 2,
        "18-30", 3,
        "31-50", 4,
        "51-65", 5,
        BLANK ()
    )
)

23.png

 

Build relationship from new table to sort table, then create matrix visual.

22.png

Custom Sorting in Power BI

 

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

6 REPLIES 6
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

You can refer to following calculate table formula to create a new table with original table records and summarize table records:

Table =
UNION (
    'Sample',
    SELECTCOLUMNS (
        SUMMARIZE (
            'Sample',
            [Land],
            [Stad],
            [geslacht],
            "leeftijdgroep", [geslacht],
            "Aantal", SUM ( 'Sample'[Aantal] )
        ),
        "Client", BLANK (),
        "Land", [Land],
        "Stad", [Stad],
        "geslacht", [geslacht],
        "leeftijdgroep", [leeftijdgroep],
        "Aantal", [Aantal]
    )
)

After these, you can create a table as custom sort order table to define column order.(you can't direct change sort order of matrix column fields)

Sort Table = 
SELECTCOLUMNS (
    VALUES ( 'Table'[leeftijdgroep] ),
    "leeftijdgroep", [leeftijdgroep],
    "Index", SWITCH (
        [leeftijdgroep],
        "M", 1,
        "V", 2,
        "18-30", 3,
        "31-50", 4,
        "51-65", 5,
        BLANK ()
    )
)

23.png

 

Build relationship from new table to sort table, then create matrix visual.

22.png

Custom Sorting in Power BI

 

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Thank you, it looks like this is going to solve the problem!

themistoklis
Community Champion
Community Champion

@Anonymous

 

On Matrix Trable, put Land as rows and as Columns put Geslacht and Leeftijdgroep.

 

Then on the matrix object on the top left click on the following icon:

 

image.png

Anonymous
Not applicable

Thanks for your response, but this gives me the output like my screenshot that i dont want as a result 🙂

The leeftijd and geslacht work like a hierarchy, for every "geslacht" it gets sliced in leeftijdsgroepen.

 

@Anonymous

 

Sorry my mistake....

I dont think you can do this with a matrix.

What you can do though is create 5 new measures for each one of the metric fields and add them on a table and not matrix.

Anonymous
Not applicable

ye was afraid it wasnt possible yet, to bad.

 

Your solution with the measures is a nice idea, but we work with a corporate tabular model so in our case it wouldt be a solution to create a lot of measures just for 1 visual (in reality it are few more columns we need)

 

Thanks again for the effort though

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors