cancel
Showing results for 
Search instead for 
Did you mean: 
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
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors