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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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