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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply

Average

Hi All, hope you're well,

 

Can you please help me with this? I'm trying to get the average site/visits per company, and I got the following measures.

 

Site  Visits = COUNTROWS(SUMMARIZE('3. CoW Productivity',DimProject[Project Number],'Calendar'[Date]DimCoWInsp[CoWInsp]))
 
Workdays = COUNTROWS(SUMMARIZE('3. CoW Productivity','Calendar'[Date]))
 
Site Visits/day =  DIVIDE( [Site  Visits] , [Workdays])
 
CoWCompCoWInspSite  VisitsWorkdaysSite Visits/day
Company 1Inspector 1151403.78
Company 1Inspector 214944293.48
Company 1Inspector 344133.38
Company 1Inspector 460183.33
Company 1Inspector 513604143.29
Company 1Inspector 661193.21
Company 1Inspector 711443693.10
Company 1Inspector 811883843.09
Company 2Inspector 98052722.96
Company 1Inspector 1032112.91
Company 3Inspector 11227802.84
Company 1Inspector 121762.83
Company 2Inspector 137272862.54
Company 2Inspector 14246972.54
Company 3Inspector 154761992.39
Company 3Inspector 1640172.35
Company 2Inspector 176302802.25
Company 3Inspector 1828142.00
Company 2Inspector 191981181.68
Company 2Inspector 201661021.63
Company 3Inspector 21641.50
Company 2Inspector 2247321.47
Company 2Inspector 221571101.43
Company 3Inspector 2347351.34
Company 3Inspector 2456471.19
Company 2Inspector 25441.00
Company 2Inspector 26661.00
  941749319.10

 

I need to get to these average site visits/day values calculated in Excel.

 

Company 13.24
Company 21.85
Company 31.95 
 Avg2.34

 

Thanks as always,

Sanitago Torres

1 ACCEPTED SOLUTION

Please try this one instead.

 

Avg Measure =
AVERAGEX (
    VALUES ( T4[CoWComp] ),
    [Site Visits/day]
)

 

Pat

Microsoft Employee

View solution in original post

11 REPLIES 11
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file and show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish @Ashish_Mathur , hope you're well. Sorry for the late reply,

 

I'm kind of new to interacting here, and I dont know how to provide the information you're requesting. I couldn't find a way to load a file. Regarding the expected results, please refer to my first post; I believe I provided all the information there.

 

Thanks for your help,

 

Hi,

Upload the file to Google Drive and share the download link here.  Show the expected result clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur, thanks for your patience. Please see below the data with formulas in Excel with the results expected to get in PBI.

Data for Avg in Excel 

 

Hi,

Share the download link of the PBI with the measures already there.  Clearly show the problem there and the expected result. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ppm1
Solution Sage
Solution Sage

Please try this measure expression. Replace T4 with your actual table name.

Avg Measure =
AVERAGEX (
    VALUES ( T4[CoWComp] ),
    CALCULATE ( AVERAGEX ( t4, T4[Site  Visits] / T4[Workdays] ) )
)

ppm1_0-1681173488371.png

Pat

 

Microsoft Employee

Hi Pat, thanks for your response,

When you get a gap, can you please tell me if Im doing something wrong here,

 

Avg Site Visits/Day = AVERAGEX( VALUES( DimCoWCom[CoWComp] ),
                                      CALCULATE( AVERAGEX('2. Observations', [Site  Visits] / [Workdays] ) ) )
                                      

These are the results I'm getting, which are not correct.

 

CoWCompAvg Site Visits/Day
Company 11
Company 21
Company 31

 

Thanks for your time,

 

Santiago Torres

Hi Pat @ppm1 , thanks for your response,

When you get a gap, can you please tell me if Im doing something wrong here,

 

Avg Site Visits/Day = AVERAGEXVALUESDimCoWCom[CoWComp] ),
                                      CALCULATEAVERAGEX('2. Observations'[Site  Visits] / [Workdays] ) ) )
                                      

These are the results I'm getting, which are not correct.

 

CoWCompAvg Site Visits/Day
Company 11
Company 21
Company 31

 

Thanks for your time,

 

Santiago Torres

Looks like you are referencing measures in your inner AVERAGEX, while I used columns. Please switch to column references and it should work.

 

Pat

Microsoft Employee

Hi Pat @ppm1, that's correct. Can you please elaborate a bit more? As you can see in my first post, these two DAX measures are coming from the data I got from previous years (massive table), so I dont have two custom columns. Hope this makes sense to you.

 
Site  VisitsCOUNTROWS(SUMMARIZE('3. CoW Productivity',DimProject[Project Number],'Calendar'[Date]DimCoWInsp[CoWInsp]))
 
WorkdaysCOUNTROWS(SUMMARIZE('3. CoW Productivity','Calendar'[Date]))
 
Thanks,
 

Please try this one instead.

 

Avg Measure =
AVERAGEX (
    VALUES ( T4[CoWComp] ),
    [Site Visits/day]
)

 

Pat

Microsoft Employee

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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