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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Syndicate_Admin
Administrator
Administrator

Tablas de Power bi

Tabla actual

Y.PARTRESFAVOR
110011A
110011B
110011C
110011D
110022B
110023O
210031B

Tabla obligatoria

Y.PARTRESFAVOR
110011DIBUJAR
110023O
210031B

Gracias

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Al modificar la consulta anterior, podemos obtener nuestro resultado requerido
es decir,

#PART_WINNING_PARTY =
DÓNDE _contar =
CALCULAR (
..MAX ( 'TABLA'[RES] ),
TODOS excepto ( 'TABLA', 'TABLA'[PARTE] )
)

DÓNDE _comprobar =
CALCULAR (
HASONEVALUE ( 'TABLA'[RESQ] ),
TODOS excepto ( 'TABLA', 'TABLA'[PARTE] )
)

DÓNDE _isDraw =
SI (
_comprobar = FALSO (),
SI (
COUNTROWS (
FILTRO (
'TABLA',
'TABLA'[PARTE] = ANTERIOR ( 'TABLA'[PARTE] ) &&
'TABLA'[RES] <> _contar
)
) = 0,
"DIBUJAR",
ESPACIO EN BLANCO ()
),
ESPACIO EN BLANCO ()
)

DEVOLUCIÓN
SI (
ISBLANK ( _isDraw ),
CALCULAR (
..MAX ( 'TABLA'[RESQ] ),
FILTRO (
'TABLA',
'TABLA'[PARTE] = ANTERIOR ( 'TABLA'[PARTE] ) &&
'TABLA'[RES] = _contar
)
),
_isDraw
)

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

Al modificar la consulta anterior, podemos obtener nuestro resultado requerido
es decir,

#PART_WINNING_PARTY =
DÓNDE _contar =
CALCULAR (
..MAX ( 'TABLA'[RES] ),
TODOS excepto ( 'TABLA', 'TABLA'[PARTE] )
)

DÓNDE _comprobar =
CALCULAR (
HASONEVALUE ( 'TABLA'[RESQ] ),
TODOS excepto ( 'TABLA', 'TABLA'[PARTE] )
)

DÓNDE _isDraw =
SI (
_comprobar = FALSO (),
SI (
COUNTROWS (
FILTRO (
'TABLA',
'TABLA'[PARTE] = ANTERIOR ( 'TABLA'[PARTE] ) &&
'TABLA'[RES] <> _contar
)
) = 0,
"DIBUJAR",
ESPACIO EN BLANCO ()
),
ESPACIO EN BLANCO ()
)

DEVOLUCIÓN
SI (
ISBLANK ( _isDraw ),
CALCULAR (
..MAX ( 'TABLA'[RESQ] ),
FILTRO (
'TABLA',
'TABLA'[PARTE] = ANTERIOR ( 'TABLA'[PARTE] ) &&
'TABLA'[RES] = _contar
)
),
_isDraw
)
Syndicate_Admin
Administrator
Administrator

Usé el dax anterior y funciona bien para la mayoría de los casos, pero en caso de RES único por PARTE, devuelve "DRAW" también, lo que no es correcto, debería devolver el valor sigle como recuento máximo. Supongo que necesito modificar la consulta para manejar ese problema. Cualquier sugerencia

Gracias

Syndicate_Admin
Administrator
Administrator

Se encontró una posible solución mediante esta columna calculada
es decir,

#PART_WINNING =
DÓNDE _contar =
CALCULAR (
..MAX ( 'TABLA'[RES] ),
TODOS excepto ( 'TABLA', 'TABLA'[PARTE] )
)
DÓNDE _isDraw =
SI (
COUNTROWS (
FILTRO (
'TABLA',
'TABLA'[PARTE] = ANTERIOR ( 'TABLA'[PARTE] ) &&
'TABLA'[RES] <> _contar
)
) = 0,
"DIBUJAR",
ESPACIO EN BLANCO ()
)
DEVOLUCIÓN
SI (
ISBLANK ( _isDraw ),
CALCULAR (
..MAX ( 'TABLA'[RESQ] ),
FILTRO (
'TABLA',
'TABLA'[PARTE] = ANTERIOR ( 'TABLA'[PARTE] ) &&
'TABLA'[RES] = _contar
)
),
_isDraw
)
Syndicate_Admin
Administrator
Administrator

Solución según el requisito: -
#column =
DÓNDE _contar =
CALCULAR (
..MAX ( 'TABLA'[RES] ),
TODOS excepto ( 'TABLA', 'TABLA'[PARTE] )
)
DÓNDE _isDraw =
SI (
COUNTROWS (
FILTRO (
'TABLA',
'TABLA'[PARTE] = ANTERIOR ( 'TABLA'[PARTE] ) &&
'TABLA'[RES] <> _contar
)
) = 0,
"DIBUJAR",
ESPACIO EN BLANCO ()
)
DEVOLUCIÓN
SI (
ISBLANK ( _isDraw ),
CALCULAR (
..MAX ( 'TABLA'[RESQ] ),
FILTRO (
'TABLA',
'TABLA'[PARTE] = ANTERIOR ( 'TABLA'[PARTE] ) &&
'TABLA'[RES] = _contar
)
),
_isDraw
)

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.