Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
dark_shad
New Member

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?

 

 

dark_shad_0-1658450501231.png

Level 3 no relationship

 

dark_shad_1-1658450608926.pngdark_shad_2-1658450675787.png

 

1 REPLY 1
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors