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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Syndicate_Admin
Administrator
Administrator

Add Measure as a Column Subtotal in a Matrix

Hello

I'm doing a shift quadrant, and I'd like to know if it's possible to add a measure as a column subtotal.

In the following image I have the quadrant and in the blank matrix, the measurements I want to add appear:

Aguirre_0-1733823332502.png

If it is not possible to have an idea to show them and if they order, they should be ordered both at the same time?

1 ACCEPTED SOLUTION

Hi @Syndicate_Admin 

 

First, add a day column to your fact table. Then create this disconnected calculated table.

CombinedDimensions = 
VAR _day =
    DISTINCT (
        SELECTCOLUMNS (
            Cuadrante,
            "Day", FORMAT ( Cuadrante[Dia], "#,#" ),
            "Sort", Cuadrante[Dia]
        )
    )
VAR tvb =
    DATATABLE (
        "Day", STRING,
        "Sort", INTEGER,
        {
            { "T", 51 },
            { "V", 52 },
            { "B", 53 }
        }
    )
RETURN
    UNION ( _day, tvb )

danextian_0-1733836953953.png

Dont forget to apply custom sort.

Create this measure to bind your fact table and this disconnected table in a viz.

CombinedValue = 
IF (
    SELECTEDVALUE ( CombinedDimensions[Sort] ) <= 31,
    CALCULATE (
        MIN ( Cuadrante[EVENTO] ),
        KEEPFILTERS ( TREATAS ( VALUES ( CombinedDimensions[Sort] ), Cuadrante[Dia] ) )
    ),
    SWITCH (
        SELECTEDVALUE ( CombinedDimensions[Day] ),
        "T", FORMAT ( [Total_mañanas], "#,0" ),
        "V", FORMAT ( [Total_Vacaciones], "#,0" ),
        "B", FORMAT ( [Total_baja], "#,0" )
    )
)

And the result is

danextian_1-1733837047835.png

Reapply conditional formatting.

 

Please see attached pbix





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

6 REPLIES 6
danextian
Super User
Super User

Hi @Syndicate_Admin.

You mean after column 31, you want to add T, V and B? Can you please post a workable sample data (not an image) or a sanitized copy of your pbix?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello.

What I want is that after the last day of the month these three calculated measures (T, V and B) appear. or some idea to visualize the two matrices in the same order and if one is ordered, the other is ordered.

I add a link in drive to share the file:

https://drive.google.com/file/d/1n5E3vDVFO2VUz640JsPX0KBhHRn9fk75/view?usp=sharing

Hi @Syndicate_Admin 

 

First, add a day column to your fact table. Then create this disconnected calculated table.

CombinedDimensions = 
VAR _day =
    DISTINCT (
        SELECTCOLUMNS (
            Cuadrante,
            "Day", FORMAT ( Cuadrante[Dia], "#,#" ),
            "Sort", Cuadrante[Dia]
        )
    )
VAR tvb =
    DATATABLE (
        "Day", STRING,
        "Sort", INTEGER,
        {
            { "T", 51 },
            { "V", 52 },
            { "B", 53 }
        }
    )
RETURN
    UNION ( _day, tvb )

danextian_0-1733836953953.png

Dont forget to apply custom sort.

Create this measure to bind your fact table and this disconnected table in a viz.

CombinedValue = 
IF (
    SELECTEDVALUE ( CombinedDimensions[Sort] ) <= 31,
    CALCULATE (
        MIN ( Cuadrante[EVENTO] ),
        KEEPFILTERS ( TREATAS ( VALUES ( CombinedDimensions[Sort] ), Cuadrante[Dia] ) )
    ),
    SWITCH (
        SELECTEDVALUE ( CombinedDimensions[Day] ),
        "T", FORMAT ( [Total_mañanas], "#,0" ),
        "V", FORMAT ( [Total_Vacaciones], "#,0" ),
        "B", FORMAT ( [Total_baja], "#,0" )
    )
)

And the result is

danextian_1-1733837047835.png

Reapply conditional formatting.

 

Please see attached pbix





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Perfect, this is just what I needed. I have analyzed the process and it is a great development.

Thanks a lot.

saud968
Super User
Super User

From the provided image, it seems you want to add the following measures as column subtotals:

TVB
ID
M
D
Adding Measures as Column Subtotals:

Unfortunately, Power BI does not directly support adding measures as column subtotals. However, we can achieve a similar effect using calculated measures and a matrix visual.

Steps:

Create Calculated Measures:

For each measure you want to subtotal, create a calculated measure that calculates the sum for the current row. For example:


TVB Subtotal = SUM(Table[TVB])
ID Subtotal = SUM(Table[ID])
M Subtotal = SUM(Table[M])
D Subtotal = SUM(Table[D])
Create a Matrix Visual:

Place the following fields in the matrix visual:

Rows: ID
Columns: 1, 2, 3, ... (your shift columns)
Values: TVB Subtotal, ID Subtotal, M Subtotal, D Subtotal
Format the Matrix:

Customize the matrix to display the subtotals in the desired format. You can adjust the font size, color, and alignment of the subtotal values.
Considerations:

Data Model: Ensure your data model is structured correctly. The measures should be based on the appropriate tables and columns.
Filter Context: Be mindful of the filter context in your matrix. If you have slicers or other filters, the subtotals will be calculated based on the filtered data.
Measure Placement: You can adjust the placement of the subtotal measures within the matrix to create a clear and intuitive layout.

Alternative Approach (Conditional Formatting):

If you want to highlight the subtotals without adding them as separate columns, you can use conditional formatting to apply different formatting to the subtotal rows. This can be done based on a specific condition, such as the row containing the subtotal values.

Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!


Hi Saud.

I don't understand what you explain to me, I have put the table in the following link, in case you can show it to me:
https://drive.google.com/file/d/1n5E3vDVFO2VUz640JsPX0KBhHRn9fk75/view?usp=sharing

Greetings and thank you.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors