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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Andrea_Fuentes
New Member

How to do operations between detail row with total rows of matricial table

I have a inconvenent to obtein one calculated column doing two operations, one of sum and other of division as I show in this image:

 

Muertes esperadas.png

Resulted must be agregated to one table of visualization type matriz.

In the before picture the operation is for each row:

Row 1) 41 * 18 / 253 = 3 (value is round) 

Row 2) 100 * 18 / 253 = 7

Row 3) 103 * 18 / 253 = 7

Row 4) 9 * 18 / 253 = 1

 

Note: Column CxIndex and #Pac Fallecidos are obteined with a messure for each one.

 

CxIndex =
VAR Valor =
CALCULATE(DISTINCTCOUNT('hce CirugiaCardioPediatrica'[IdDimCirugiaSts]), 
FILTER('hce CirugiaCardioPediatrica', 'hce CirugiaCardioPediatrica'[CirugiaIndex] = 1)) --> Marca que indica que es Index (1)
RETURN
IF(ISBLANK(Valor), 0, Valor) --> Validate null values
 
Pac Fallecidos = -- Pacientes fallecidos agrupados por grupo etario
CALCULATE(DISTINCTCOUNT('hce CirugiaCardioPediatrica'[IdCliente]),
FILTER('hce CirugiaCardioPediatrica','hce CirugiaCardioPediatrica'[Estado Egreso] = "Muerto"),
FILTER('hce CirugiaCardioPediatrica', 'hce CirugiaCardioPediatrica'[CirugiaIndex] = 1) --> Cx Index (única por atención)
)
1 ACCEPTED SOLUTION
AlB
Super User
Super User

 

Hi @Andrea_Fuentes 

Place this measure in the table visual you show above

 

Measure =
VAR aux1_ = CALCULATE ( [CxIndex], ALL ( Table1[Grupo_Etario] ) )
VAR aux2_ = CALCULATE ( [Pac Fallecidos], ALL ( Table1[Grupo_Etario] ) )
RETURN
    SUMX (
        DISTINCT ( Table1[Grupo_Etario] ),
        ROUND ( DIVIDE ( [CxIndex] * aux2_, aux1_ ), 0 )
    )

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

 

View solution in original post

1 REPLY 1
AlB
Super User
Super User

 

Hi @Andrea_Fuentes 

Place this measure in the table visual you show above

 

Measure =
VAR aux1_ = CALCULATE ( [CxIndex], ALL ( Table1[Grupo_Etario] ) )
VAR aux2_ = CALCULATE ( [Pac Fallecidos], ALL ( Table1[Grupo_Etario] ) )
RETURN
    SUMX (
        DISTINCT ( Table1[Grupo_Etario] ),
        ROUND ( DIVIDE ( [CxIndex] * aux2_, aux1_ ), 0 )
    )

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.