zapppsr
Board Regular
- Joined
- Aug 19, 2010
- Messages
- 189
Hi!
I have a data set with this structure:
I need to calculate the % of Matrículas per Type A or B in different granularity.
I need to SUM all Matriculas for one of the Granularity (Ano, VP, Eixo, Produto) and divide to ALL Matriculas in that Granularity.
This measure works fine, as long all itens are present:
% Matricula =
SUM ( fTecnicos[Matriculas] )
/ CALCULATE (
SUM ( fTecnicos[Matriculas] );
ALL ( fTecnicos );
VALUES ( fTecnicos[Ano] );
VALUES ( fTecnicos[VP] );
VALUES ( fTecnicos[Eixo] );
VALUES ( fTecnicos[Produto] )
)
The problem is that in some combinations, Type B is not present, so when it goes down to VALUES ( fTecnicos[Produto] ) for instance, the total of the denominator misses some values. Look at the image below, where the Denominator in B is 1828 where it should be 1838. That is occurring because in that VP There is no Type B. The problem doesn't happen if you remove VALUES ( fTecnicos[Produto] because at the Year and VP level everything is present.
I tried many different approaches but I'm not seeing the light at the end of the tunnel...
I don't know if the VALUES approach is the best one...
At the image, you can see MEASURE with wrong values and a QUICK CALC with correct values.
Please help!!
I have a data set with this structure:
- Ano (Year)
- VP
- Eixo
- Produto
- Tipo
- Matriculas
I need to calculate the % of Matrículas per Type A or B in different granularity.
I need to SUM all Matriculas for one of the Granularity (Ano, VP, Eixo, Produto) and divide to ALL Matriculas in that Granularity.
This measure works fine, as long all itens are present:
% Matricula =
SUM ( fTecnicos[Matriculas] )
/ CALCULATE (
SUM ( fTecnicos[Matriculas] );
ALL ( fTecnicos );
VALUES ( fTecnicos[Ano] );
VALUES ( fTecnicos[VP] );
VALUES ( fTecnicos[Eixo] );
VALUES ( fTecnicos[Produto] )
)
The problem is that in some combinations, Type B is not present, so when it goes down to VALUES ( fTecnicos[Produto] ) for instance, the total of the denominator misses some values. Look at the image below, where the Denominator in B is 1828 where it should be 1838. That is occurring because in that VP There is no Type B. The problem doesn't happen if you remove VALUES ( fTecnicos[Produto] because at the Year and VP level everything is present.
I tried many different approaches but I'm not seeing the light at the end of the tunnel...
I don't know if the VALUES approach is the best one...
At the image, you can see MEASURE with wrong values and a QUICK CALC with correct values.
Please help!!
Last edited: