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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors