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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AleMacedo
Helper I
Helper I

Need help with formula

I have 4 tables with relationships:

 

- UA: IdUnit, UnitName, IdUnitDependents and informations about Units

         IdUnitDependents is lilke 1 < 239 < 938 where each number corresponds a hierarchy IdUnit

- Adressess : Units Adressess, City, ZipCode

- Employees: NameofEmployee, UA (Employee IdUnit)

- UnitsExpenses: Expenses with maintenance of buildings

Need to calculate:

- Number of Employees in each UA (Unit), including dependents (need to search number inside IdUnitDependents column) like need to know count of employess with code 239 in IdUnitDependents

- Sum of Expenses with maintenance calculated for Unit including depentens same as Employess - is necessary to Divide Total Expenses per Adress than divide per Employes in this adress and then multiply per Employees of Unit with dependents


 

I have this formula to calculate expenses:
Per Person: 

 

Servico Continuo por Pessoa =
var IntegrantesAtivosCTIC = calculate(count(Integrante[NomeIntegrante]), filter(all(Integrante),Integrante[FlagSituacao]="A"))
var IntegrantesAtivosADM = calculate(count(Integrante[NomeIntegrante]),Integrante[FlagSituacao]="A")
var SContinuos = SUMMARIZE(DespesasTotais,DespesasTotais[DESPESA],DespesasTotais[Período],DespesasTotais[Cidade],DespesasTotais[RefIDEnd],"Valor Total", calculate(sum(DespesasTotais[Valor]),DespesasTotais[GRUPO]="Serviços Contínuos",DespesasTotais[GrupoContínuos] = "REGULAR"))
var SContinuosCTIC = SUMMARIZE(DespesasTotais,DespesasTotais[DESPESA],DespesasTotais[Período],"Valor Total",CALCULATE(sum(DespesasTotais[Valor]),DespesasTotais[GrupoContínuos]="CTIC"))
return
divide(sumx(SContinuos,[Valor Total]),IntegrantesAtivosADM) + Divide(sumx(SContinuosCTIC,[Valor Total]),IntegrantesAtivosCTIC)

 

Per Unit:

Servico Continuo por UA =
var IntegrantesAtivosUnidade = SUMMARIZE(Integrante,Integrante[IdUA],"IntegrantesUA", calculate(count(Integrante[NomeIntegrante]),Integrante[FlagSituacao]="A"))
var SContinuosPessoa = 'Medidas Despesas por UA'[Servico Continuo por Pessoa]
return
SContinuosPessoa*sumx(IntegrantesAtivosUnidade,[IntegrantesUA])


Need to include dependents in these formulas and know if the formulas are ok. To complicated for me.
Thanks in advance.
 
1 ACCEPTED SOLUTION
2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @AleMacedo ,

It's hard to reproduce your problem without a sample, could you please give an example to illustrate your problem?

Best Regards,
Community Support Team _ kalyj

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.