Forum Discussion
RANKX not working with SELECTEDMEASURE when calculation group is filter
- 2 years ago
This solves the problem:
1. Rename the Calculation Group table from "Medidas" to "Medidas - Oculto"
2. Duplicate the table of the Calculation Group, and name this copy to "Medidas"
3. Rename the "Medida" measure to "Medida Interna" and change the value to:
Medida Interna = SUMX ( SUMMARIZE ( dEmpresas, dEmpresas[Grupo Abrev], dEmpresas[CNPJ] ), CALCULATE ( AVERAGE ( mIndicadores[QProcessados] ) ) )4. Create a "Medida" measure:
Medida = CALCULATE( [Medida Interna], TREATAS( VALUES(Medidas[Tipo Medida]), 'Medidas - Oculto'[Tipo Medida] ) )5. Change the code of all Calculated Items:
IF ( ISSELECTEDMEASURE ( [Medida Interna] ), SUMX ( SUMMARIZE ( dEmpresas, dEmpresas[Grupo Abrev], dEmpresas[CNPJ] ), CALCULATE ( AVERAGE ( ***FILED*** ) ) ), SELECTEDMEASURE () )6. Hide the calculation group "Medidas - Oculto".
Or just, folow this video to get the same result:
This solves the problem:
1. Rename the Calculation Group table from "Medidas" to "Medidas - Oculto"
2. Duplicate the table of the Calculation Group, and name this copy to "Medidas"
3. Rename the "Medida" measure to "Medida Interna" and change the value to:
Medida Interna = SUMX (
SUMMARIZE ( dEmpresas, dEmpresas[Grupo Abrev], dEmpresas[CNPJ] ),
CALCULATE ( AVERAGE ( mIndicadores[QProcessados] ) )
)4. Create a "Medida" measure:
Medida = CALCULATE(
[Medida Interna],
TREATAS(
VALUES(Medidas[Tipo Medida]),
'Medidas - Oculto'[Tipo Medida]
)
)5. Change the code of all Calculated Items:
IF (
ISSELECTEDMEASURE ( [Medida Interna] ),
SUMX (
SUMMARIZE ( dEmpresas, dEmpresas[Grupo Abrev], dEmpresas[CNPJ] ),
CALCULATE ( AVERAGE ( ***FILED*** ) )
),
SELECTEDMEASURE ()
)
6. Hide the calculation group "Medidas - Oculto".
Or just, folow this video to get the same result: