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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
jonnyA
Responsive Resident
Responsive Resident

sum a total with a field that has an average

Hello and thanks in advance for helping me.

I have a table, and in my table I have a field for Average Salary, but I need the Average Salary to sum in the total.  Any suggestions on how to sum correctly?  Highlighted # below should be $210,000, not $105,425.

jonnyA_0-1686083079519.png

Thank you 🙂

jonnyA_1-1686083277330.png

 

 

 

 

10 REPLIES 10
jonnyA
Responsive Resident
Responsive Resident

jonnyA
Responsive Resident
Responsive Resident

@VilmarSch 

I'm basically using a Provider Name and Provider Salary.  Here is the formula for Provider Salary aka Salary Numeric 6.7.23.

 

Salary Numeric 6.7.23 = SUMX ( VALUES ( Dataset[Salary_Numeric] ), CALCULATE ( AVERAGE ( Dataset[Salary_Numeric] ) ) )
 
Grand Total is not working.
 
Can you provide examples on how I can get the formula to work?
 
Thank you 🙂
 
 

 

 

I needed a sample of your data. But see if it helps

 

Salary Numeric 6.7.23 =
SUMX (
    VALUES ( Dataset[Provider Name] ),
    CALCULATE ( AVERAGE ( Dataset[Salary_Numeric] ) )
)

 

jonnyA
Responsive Resident
Responsive Resident

@VilmarSch 

Thank you for the reply.  The previously formula was not 100% accurate, although, I feel like you are on the right path.  The "Salaray Numeric 6.7.23" makes rthe row total correct, however, the Grand total is way off.  The newest formula you sent me also sums the row total correctly, and the Grand Total is only about half off the correct amount (When all Providers are selected).  Here is the last foirmula you sent me, which I feel is close: Salary Numeric 6.7.23 = SUMX ( VALUES ( Dataset[Provider Name] ), CALCULATE ( AVERAGE ( Dataset[Salary_Numeric] ) ) ).  Is it possible to create a formual that substitutes "Salary Numeric" with "Salary Numeric 6.7.23"?  It wont let substitute in the last formula you sent.  I'm assuming because it is a calculated measure, i dont know?  Thank you in advance!

 

 

Seria bom que enviasse uma amostra dos seus dados. Pode ser fictícios.

jonnyA
Responsive Resident
Responsive Resident

@VilmarSch That worked for the row totals using this formula ↓

Salary Numeric 6.7.23 = SUMX ( VALUES ( rpt_Reconciliation[Salary_Numeric] ), CALCULATE ( AVERAGE ( rpt_Reconciliation[Salary_Numeric] ) ) )
 
But now, the Grand Total is off.  Any suggestions on how to fix?  Thank you!
jonnyA_0-1686155950647.png

 

 

 

 

Soma da Média = 
VAR TabelaResumida =
    SUMMARIZECOLUMNS ( dCalendar[Ano], dCalendar[MesId] )
VAR MediasMensais =
    SUMX ( TabelaResumida, CALCULATE ( AVERAGE ( fVendas[Qtd] ) ) )
RETURN
    MediasMensais

Captura de tela 2023-06-07 202649.jpg

jonnyA
Responsive Resident
Responsive Resident

@VilmarSch using the "Salary Numeric 6.7.23" formual I commented earlier.  Can you help me plug in the fields and caluclations that you referred to me on your last comment?

Send your pbix please. It can be with dummy data

VilmarSch
Post Patron
Post Patron

Use medidas

Exemplo:

Soma da Média =
SUMX ( VALUES ( dProduto[Categoria] ), CALCULATE ( AVERAGE ( fVendas[Qtd] ) ) )

 

Sem título.png

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.