Forum Discussion
RANKX not working with SELECTEDMEASURE when calculation group is filter
I cant understand why this is not working with a calculated Group:
Variable Rank of SELECTEDMEASURE = RANKX(ALL(dEmpresas[Grupo Abrev]), SELECTEDMEASURE ())but this works (when calculated Group is not filted):
Fixed Rank of Admissões = RANKX(ALL(dEmpresas[Grupo Abrev]), [Admissões])
Calculated Group Measure:
Medida = SELECTEDMEASURE ()
Measure in the calculation Group Sample1 (M Admissões) (igual to "Admissões" measure):
SUMX(
SUMMARIZE(dEmpresas, dEmpresas[CNPJ]),
CALCULATE(
AVERAGE(mIndicadores[QAdmissões]
)
)
)Measure in the calculation Group Sample2 (M Férias) (igual to "Func. Processados" measure):
SUMX(
SUMMARIZE(dEmpresas, dEmpresas[CNPJ]),
CALCULATE(
AVERAGE(mIndicadores[QFérias]
)
)
)
When the calculated group field "Tipo Medida" is not selected:
When the calculated group field "Tipo Medida" is selected:
Can some one please help me?
NOTE: I have a dummy pbix file to test this, and if someone allow, I can post here (my user has more than 5 years).
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:
1 Reply
- danielpcamara
Resolver I
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: