Different Granularity, % calculation problem

zapppsr

Board Regular
Joined
Aug 19, 2010
Messages
189
Hi!

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!!

granularity.png
 
Last edited:

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,225,730
Messages
6,186,698
Members
453,369
Latest member
positivemind

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top