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! Learn more

Reply
Crissceron
Frequent Visitor

Matrix subtotal per column issue - Need help with a measure to show column subtotals in a matrix

I'm working on a Power BI matrix where I have two columns in the rows: [Date] from 'TablaCalendario' and [Turnos] from 'Tabla turnos'. In the columns of the matrix, I'm using the [Ingresos] column from 'Tipo de ingresos', which has six values: Perforacion, Horas cliente, Habilitación, Instalación sonda, Equipo bombeo, and Otros.

I've created a measure called "Ingresos Diarios" to calculate the values for the matrix, and it's showing the values correctly. However, the measure is not summing the values by column, only by row. So when I add a Total column, it shows blanks values instead of the correct sum of values.

 

You can see the next picture as example.

 

Crissceron_0-1684116406693.png


This is the code for the measure "Ingresos diarios" 

 

 

Ingresos Diarios = 
SWITCH (
    TRUE (),
    HASONEVALUE ('Tipo de ingresos'[Ingresos]),
        SWITCH (
            SELECTEDVALUE ('Tipo de ingresos'[Ingresos]),
            "Perforacion", SUMX ('Curva S', 'Curva S'[Ingreso por ventas]),
            "Horas cliente", SUMX ('Hrasfaenas', 'Hrasfaenas'[Ingreso por horas]),
            "Habilitación", 
                
                   SUMX ('LBRDR S42 habilitacion', 'LBRDR S42 habilitacion'[Ingreso por habilitacion real])+
                    SUMX ('LBRDR habilitacion horas', 'LBRDR habilitacion horas'[Ingreso habilitacion desarrollo + limpieza]),
            "Instalación sonda", SUMX ('LBRDR instalacion', 'LBRDR instalacion'[Ingreso por instalacion sonda]),
            BLANK()
        ),
    BLANK()
)

 

 



Can anyone help me create a measure that will show the row subtotals in the matrix correctly? Thanks in advance for your help!

 

 

1 ACCEPTED SOLUTION
Crissceron
Frequent Visitor

I found the solution 

Ingresos Diariosdos =
SWITCH (
    TRUE (),
    HASONEVALUE ('Tipo de ingresos'[Ingresos]),
        SWITCH (
            SELECTEDVALUE ('Tipo de ingresos'[Ingresos]),
            "Perforacion", SUMX ('Curva S', 'Curva S'[Ingreso por ventas]),
            "Horas cliente", SUMX ('Hrasfaenas', 'Hrasfaenas'[Ingreso por horas]),
            "Habilitación",
               
                SUMX ('LBRDR S42 habilitacion', 'LBRDR S42 habilitacion'[Ingreso por habilitacion real]) +
                SUMX ('LBRDR habilitacion horas', 'LBRDR habilitacion horas'[Ingreso habilitacion desarrollo + limpieza]),
            "Instalación sonda", SUMX ('LBRDR instalacion', 'LBRDR instalacion'[Ingreso por instalacion sonda]),
            //"Equipo bombeo", 0,  // Summing values for the "Equipo bombeo" category
            //"Otros", 0,  // Summing values for the "Otros" category
            BLANK()
        ),
    SUM('Curva S'[Ingreso por ventas])+SUM('Hrasfaenas'[Ingreso por horas])+SUM('LBRDR S42 habilitacion'[Ingreso por habilitacion real])+sum('LBRDR habilitacion horas'[Ingreso habilitacion desarrollo + limpieza])+SUM('LBRDR instalacion'[Ingreso por instalacion sonda])  // Summing values for the Total column
)


View solution in original post

3 REPLIES 3
Crissceron
Frequent Visitor

I found the solution 

Ingresos Diariosdos =
SWITCH (
    TRUE (),
    HASONEVALUE ('Tipo de ingresos'[Ingresos]),
        SWITCH (
            SELECTEDVALUE ('Tipo de ingresos'[Ingresos]),
            "Perforacion", SUMX ('Curva S', 'Curva S'[Ingreso por ventas]),
            "Horas cliente", SUMX ('Hrasfaenas', 'Hrasfaenas'[Ingreso por horas]),
            "Habilitación",
               
                SUMX ('LBRDR S42 habilitacion', 'LBRDR S42 habilitacion'[Ingreso por habilitacion real]) +
                SUMX ('LBRDR habilitacion horas', 'LBRDR habilitacion horas'[Ingreso habilitacion desarrollo + limpieza]),
            "Instalación sonda", SUMX ('LBRDR instalacion', 'LBRDR instalacion'[Ingreso por instalacion sonda]),
            //"Equipo bombeo", 0,  // Summing values for the "Equipo bombeo" category
            //"Otros", 0,  // Summing values for the "Otros" category
            BLANK()
        ),
    SUM('Curva S'[Ingreso por ventas])+SUM('Hrasfaenas'[Ingreso por horas])+SUM('LBRDR S42 habilitacion'[Ingreso por habilitacion real])+sum('LBRDR habilitacion horas'[Ingreso habilitacion desarrollo + limpieza])+SUM('LBRDR instalacion'[Ingreso por instalacion sonda])  // Summing values for the Total column
)


Crissceron
Frequent Visitor

It didn't work.. 

 

Crissceron_0-1684151810380.png

It was my fault to explain the problem, it is not the subtotal per row.. it is the subtotal per column where i have the problem, still giving me blanks values. 

amitchandak
Super User
Super User

@Crissceron , Try like

 

Ingresos Diarios =
Sumx(
values ('Tipo de ingresos'[Ingresos]),
SWITCH (
SELECTEDVALUE ('Tipo de ingresos'[Ingresos]),
"Perforacion", SUMX ('Curva S', 'Curva S'[Ingreso por ventas]),
"Horas cliente", SUMX ('Hrasfaenas', 'Hrasfaenas'[Ingreso por horas]),
"Habilitación",

SUMX ('LBRDR S42 habilitacion', 'LBRDR S42 habilitacion'[Ingreso por habilitacion real])+
SUMX ('LBRDR habilitacion horas', 'LBRDR habilitacion horas'[Ingreso habilitacion desarrollo + limpieza]),
"Instalación sonda", SUMX ('LBRDR instalacion', 'LBRDR instalacion'[Ingreso por instalacion sonda]),
BLANK()
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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