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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
nithinsakhamuri
Frequent Visitor

Adding columns in matrixI

Imagine I have the following tableImage 11-15-22 at 5.51 PM.jpeg

 

And I need a matrix like this: I tried adding the allocation and selection columns but no luck.

Image 11-15-22 at 5.53 PM.jpeg

Thank you very much!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @nithinsakhamuri ,

Please try below steps:

1. below is my test table:
Table:

vbinbinyumsft_1-1669275734521.png

2. create a measure with below dax formula

Measure =
IF (
    HASONEFILTER ( 'Table'[Calculation] ),
    CALCULATE (
        SUM ( 'Table'[Value] ),
        'Table'[Calculation] = SELECTEDVALUE ( 'Table'[Calculation] )
    ),
    SUMX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Calculation] IN { "Selection", "Allocation" }
        ),
        [Value]
    ) & "(allocation+selection)"
)

3. add a matrix visual with measure and field

vbinbinyumsft_2-1669275846860.png

set the column subtotal label:

vbinbinyumsft_3-1669275889725.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
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

4 REPLIES 4
Anonymous
Not applicable

Hi @nithinsakhamuri ,

Please try below steps:

1. below is my test table:
Table:

vbinbinyumsft_1-1669275734521.png

2. create a measure with below dax formula

Measure =
IF (
    HASONEFILTER ( 'Table'[Calculation] ),
    CALCULATE (
        SUM ( 'Table'[Value] ),
        'Table'[Calculation] = SELECTEDVALUE ( 'Table'[Calculation] )
    ),
    SUMX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Calculation] IN { "Selection", "Allocation" }
        ),
        [Value]
    ) & "(allocation+selection)"
)

3. add a matrix visual with measure and field

vbinbinyumsft_2-1669275846860.png

set the column subtotal label:

vbinbinyumsft_3-1669275889725.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

It may be possible.  Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
nithinsakhamuri
Frequent Visitor

Thank you for the response.

Is there any way to add the attribute(allocation+selection) row in the Calculation Column?

 

vicky_
Super User
Super User

Try go to the settings and "Switch values to rows" under Values > Options.

vicky__0-1668555242945.png

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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