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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
dataanalyst2023
Frequent Visitor

Measure to calculate Average

Hi all, 

 

I have 2 tables as shown below. I'm trying to write a DAX to get the Average of the "Actual Rate" and "Potential Rate". the reason why I have two tables is the raw data for the first table is by date as for the second table is just by location. 

 

Table 1: 

dataanalyst2023_0-1715027936207.png

 

Table 2:

dataanalyst2023_1-1715027961179.png

 

This is how I have it written in excel, I can't seem to be able to get the same results in Power Bi. 

 

Actual Rate = ([AVG(Actual Index)]*[5 Week Incident Count]/1000)*200000/[5 Week Hours]

Potential Rate = ([AVG(Potential Index)]*[5 Week Incident Count]/1000)*200000/[5 Week Hours]

 

Thank you in advanced. 

 

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @dataanalyst2023 ,

Depending on the information you have provided, you can follow these steps below:

1.Merge Queries.

vyifanwmsft_0-1715046669716.png

2.Add new columns.

Actual Rate =
VAR _AverageActual =
    AVERAGE ( 'Table 1'[Average Actual Index] )
VAR _WeekIncidentCount = 'Table 1'[Table 2_5 week Incident Count] / 1000
VAR _WeekHours = 200000 / 'Table 1'[Table 2_5 Week worked Hours]
RETURN
    _AverageActual * _WeekIncidentCount * _WeekHours
Potential Rate =
VAR _AveragePotential =
    AVERAGE ( 'Table 1'[Average Potential Index] )
VAR _WeekIncidentCount = 'Table 1'[Table 2_5 week Incident Count] / 1000
VAR _WeekHours = 200000 / 'Table 1'[Table 2_5 Week worked Hours]
RETURN
    _AveragePotential * _WeekIncidentCount * _WeekHours

 

Final output:

vyifanwmsft_1-1715046827902.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

Hi @dataanalyst2023 ,

You can certainly add multiplication between two lines, and you can check out the documentation below to see how the VAR function is used, which can help you understand it better:
Use variables to improve your DAX formulas - DAX | Microsoft Learn

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
dataanalyst2023
Frequent Visitor

Thank you for your help. Its almost working. 

 

Can I add multiplication between these two lines

dataanalyst2023_0-1715115073231.png

 

and these two?

dataanalyst2023_1-1715115095357.png

 

these are the results I'm getting 

dataanalyst2023_3-1715115181270.png

 

these are what I need 

dataanalyst2023_4-1715115197686.png

 

Thank you so much for your help again. 

Anonymous
Not applicable

Hi @dataanalyst2023 ,

You can certainly add multiplication between two lines, and you can check out the documentation below to see how the VAR function is used, which can help you understand it better:
Use variables to improve your DAX formulas - DAX | Microsoft Learn

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @dataanalyst2023 ,

Depending on the information you have provided, you can follow these steps below:

1.Merge Queries.

vyifanwmsft_0-1715046669716.png

2.Add new columns.

Actual Rate =
VAR _AverageActual =
    AVERAGE ( 'Table 1'[Average Actual Index] )
VAR _WeekIncidentCount = 'Table 1'[Table 2_5 week Incident Count] / 1000
VAR _WeekHours = 200000 / 'Table 1'[Table 2_5 Week worked Hours]
RETURN
    _AverageActual * _WeekIncidentCount * _WeekHours
Potential Rate =
VAR _AveragePotential =
    AVERAGE ( 'Table 1'[Average Potential Index] )
VAR _WeekIncidentCount = 'Table 1'[Table 2_5 week Incident Count] / 1000
VAR _WeekHours = 200000 / 'Table 1'[Table 2_5 Week worked Hours]
RETURN
    _AveragePotential * _WeekIncidentCount * _WeekHours

 

Final output:

vyifanwmsft_1-1715046827902.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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