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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
joaquinel
Helper I
Helper I

Wrong column totals in a matrix

Hi, I have a problem with a formula when using matrix. I have use two ways but no one is perfect. I need you to help me to mix two formules. If I use de Formule1 I get the result I want, but the column total is wrong, but if I use the second formula I don't have the desired result but the total is correct. How should I mix this two formules? thanks

 

Fórmula1
 
CALCULATE
(
    DISTINCTCOUNT
        (
            Pagos[IdPersonaOrigen] 
            )
            ,
            USERELATIONSHIP(
    '1CalFCreacion'[Date]
            ,
    ContratosServicio[FechaAlta]
    )
    ,
    USERELATIONSHIP(
    Pagos[IdPersonaOrigen]
    ,
    ContratosServicio[IdUsuario]
    )
    ,
    Pagos[CuentaContable] = "70510030"
    ,
    FILTER ( VALUES(Personas[EsEmpleado]) , "False"),
    FILTER(
        ServiciosContratables,
        ServiciosContratables[IdTipoServicio] = 5 || ServiciosContratables[IdTipoServicio] = 7
    )
        )
 
Fórmula2
 
COUNTX
(   
    Pagos
    ,
    CALCULATE
    (DISTINCTCOUNT(Pagos[IdPersonaOrigen])
     ,
    USERELATIONSHIP(
    '1CalFCreacion'[Date]
    ,
    ContratosServicio[FechaAlta]
    )
    , 
   USERELATIONSHIP(
    Pagos[IdPersonaOrigen]
    ,
    ContratosServicio[IdUsuario]
    )
    ,
    Pagos[CuentaContable] = "70510030"
    ,
    FILTER ( VALUES(Personas[EsEmpleado]) , "False"),
    FILTER(
        ServiciosContratables,
        ServiciosContratables[IdTipoServicio] = 5 || ServiciosContratables[IdTipoServicio] = 7
    ) 
)
)
formulacuenta.jpg
1 REPLY 1
Ahmedx
Super User
Super User

write another measure like this

Fórmula1 fixed = SUMX(VALUES('Date'[Day]),[Fórmula1]) 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.