Forum Discussion

dark_shad's avatar
dark_shad
New Member
4 years ago

Different calculation in Matrix for subtotal with switch

Hi,

I'm trying to make a relationship to a matrix model because my first subtotal is not the sum of the totals below, but a certain value. My structure is basically: level 1: 'TYPE - pt: TIPO' Level 2: MANAGEMENT - pt: Gerencia Level 3: Cost Center - pt: Centro de Custo My dimension is level 3, where until then, levels 1 and 2 were just category information. Now to try to solve it, I opened 2 dimensions: one for level 1 and another for level 2, but when trying to relate to the cost center, it gives the failure below (attachment). If I manage to do the cost center one, the other 2 (level 1 and 2 don't work).

 

The measure I'm using is the following. The switch will be used when joining everything into a single table.

 

 

 

ProduçãoOrçado = CALCULATE(SUM('fProduçõesCustos'[Valor]),'fProduçõesCustos'[TipoInformação] = "Orçado")
--SWITCH(
-- true(),
-- ISINSCOPE(dCentroCusto[Centro de Custo]),IF(ISBLANK(Medidas[Orcamento]),"",CALCULATE(SUM('fProduçõesCustos'[Valor]),'fProduçõesCustos'[TipoInformação] = "Orçado" )),
-- ISINSCOPE(dIndicadoresGerencia[Gerência]), CALCULATE(SUM('fProduçõesCustos'[Valor]),'fProduçõesCustos'[TipoInformação] = "Orçado"),
-- ISINSCOPE(dCentroCusto[Tipo]), CALCULATE(SUM('fProduçõesCustos'[Valor]),'fProduçõesCustos'[TipoInformação] = "Orçado" ),
-- ISINSCOPE(dIndicadorTipo[Tipo]), CALCULATE(SUM('fProduçõesCustos'[Valor]),'fProduçõesCustos'[TipoInformação] = "Orçado" )
-- )

 

 

What could be happening?

 

 

Level 3 no relationship

 

 

1 Reply