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
calerof
Impactful Individual
Impactful Individual

Measure per hour per person and overall team

Hello all,

 

I have a chart showing the volume processed by each user in the columns, and in the line I'm showing the average volume per hour. That works fine. What I need is to show in addition is a horizontal straight line with the overall average of volume per hour for the whole team.

 

I have a simple measure to calculate each individual's average volume per hour as follows:

 

Units per hour = DIVIDE(
			SUMX('Hoja de Trabajo', 'Hoja de Trabajo'[CONTAINERS_PROCESSED]),
			DISTINCTCOUNT('Hoja de Trabajo'[Hora])
)

 

My chart with this correct measure looks like this:

 

Average volumen per hour per each individualAverage volumen per hour per each individual

 

But I'm trying to calculate the overall average of volumen per hour with the following code and shows wrong values:

 

Overall average per hour = DIVIDE(
				SUMX(ALLSELECTED('Hoja de Trabajo'),'Hoja de Trabajo'[CONTAINERS_PROCESSED]),
				DISTINCTCOUNT('Hoja de Trabajo'[Hora])
				)

 

Now with this measure my chart looks like follows:

 

Overall average of volume per hour for the whole teamOverall average of volume per hour for the whole team

The correct value for the team in this month is 4,443.08 units per hour. That value shows correctly in user # 1, 3, 4, 5. But the rest have strange figures that I don't understand where did they come from. 

 

Here's my data:

 

 

Data (in excel)

 

start_month2          
            
Sum of CONTAINERS_PROCESSEDUser #          
Row LabelsU1306535U1322541U1326259U1434227U1434234U1522978U1704125U1718016U1799142U1985457Grand Total
0695638451,1911,151 682   4,627
1440876601,0291,043 628   3,887
2143 258327253 108   1,089
3559586541,2711,206 660   4,408
45861134241,2561,031 498 17 3,925
528336258707972 343 50 2,649
632729301290391711182905571,879
71,350 1,08213368756 1,479 8655,733
81,346 1,2211541309824111,802 8676,913
91,705 1,327791399278051,428 9997,409
101,189431,055129949056121,705 7056,437
11171 4493930809568638 602,764
121,098 1,2161091567856461,336 4235,769
131,127 94321970930541972 4675,269
14151 373135123617171325 1912,086
15120 1181,0751,0909182971,373 6325,623
1695371361,2851,1609602611,481 5245,939
171491161351,6181,2091,6851781,283 5016,874
1834 58636998694 624 3203,364
1965 1061,3061,145376 842 6574,497
20139 1091,3941,394189 693 8174,735
2182 981,3391,169142 369 4703,669
223425621534521 456   2,479
23635461,1091,2581,062 500   4,610
Grand Total12,83163313,55617,51316,60511,7468,48316,640728,555106,634

 

With these data, e.g. the user # 1799142 processed 72 units in total in February, and in average 24 per hour. That is shown correctly with the first measure in the next chart detail:

 

Average volumen per hour for user # 1799142Average volumen per hour for user # 1799142

And the overall average volumen per hour for the team is 4,443.08 (I verified it with a pivot table in the original excel file shown below):

 

Overall average volume per hour in the original excel fileOverall average volume per hour in the original excel file

Could anyone please help?

Thanks,

Fernando

 

P.S. I don't know how to enclose my data

3 ACCEPTED SOLUTIONS
Sean
Community Champion
Community Champion

@calerof This should work...

 

Measure =
DIVIDE (
    CALCULATE (
        SUM ( 'Hoja de Trabajo'[CONTAINERS_PROCESSED] ),
        ALL ( 'Hoja de Trabajo' )
    ),
    CALCULATE (
        DISTINCTCOUNT ( 'Hoja de Trabajo'[Hora] ),
        ALL ( 'Hoja de Trabajo' )
    ),
    0
)

 

EDIT: Seems to work...

 

Measure per Hour.png 

View solution in original post

calerof
Impactful Individual
Impactful Individual

Hello Sean,

 

Thank you very much for your response. I enter the code exactly as you suggested:

 

Cont por Hora Equipo = DIVIDE(
				CALCULATE(
					SUM('Hoja de Trabajo'[CONTAINERS_PROCESSED]),
					ALL('Hoja de Trabajo')
				),
				CALCULATE(
					DISTINCTCOUNT('Hoja de Trabajo'[Hora]),
					ALL('Hoja de Trabajo')
				),
			0)

But my result is 7,823.79 instead of 4,443.08 as you show and what is the right amount. Weird, isn't it? I'm not sure what did I do wrong?

 

Result of your suggested formulaResult of your suggested formula

View solution in original post

calerof
Impactful Individual
Impactful Individual

 

@Sean,

 

I just made a small change, i.e. ALLSELECTED as follows, and now it's up and working!

Thanks a lot!

Fernando

Cont por Hora Equipo = DIVIDE(
			CALCULATE(
			  SUM('Hoja de Trabajo'[CONTAINERS_PROCESSED]),
			  ALLSELECTED('Hoja de Trabajo')
			  ),
			CALCULATE(
			  DISTINCTCOUNT('Hoja de Trabajo'[Hora]),
			  ALL('Hoja de Trabajo')
			),
		      0)

 

Right overall average volume per hourRight overall average volume per hour

View solution in original post

4 REPLIES 4
Sean
Community Champion
Community Champion

@calerof This should work...

 

Measure =
DIVIDE (
    CALCULATE (
        SUM ( 'Hoja de Trabajo'[CONTAINERS_PROCESSED] ),
        ALL ( 'Hoja de Trabajo' )
    ),
    CALCULATE (
        DISTINCTCOUNT ( 'Hoja de Trabajo'[Hora] ),
        ALL ( 'Hoja de Trabajo' )
    ),
    0
)

 

EDIT: Seems to work...

 

Measure per Hour.png 

calerof
Impactful Individual
Impactful Individual

Hello Sean,

 

Thank you very much for your response. I enter the code exactly as you suggested:

 

Cont por Hora Equipo = DIVIDE(
				CALCULATE(
					SUM('Hoja de Trabajo'[CONTAINERS_PROCESSED]),
					ALL('Hoja de Trabajo')
				),
				CALCULATE(
					DISTINCTCOUNT('Hoja de Trabajo'[Hora]),
					ALL('Hoja de Trabajo')
				),
			0)

But my result is 7,823.79 instead of 4,443.08 as you show and what is the right amount. Weird, isn't it? I'm not sure what did I do wrong?

 

Result of your suggested formulaResult of your suggested formula

calerof
Impactful Individual
Impactful Individual

 

@Sean,

 

I just made a small change, i.e. ALLSELECTED as follows, and now it's up and working!

Thanks a lot!

Fernando

Cont por Hora Equipo = DIVIDE(
			CALCULATE(
			  SUM('Hoja de Trabajo'[CONTAINERS_PROCESSED]),
			  ALLSELECTED('Hoja de Trabajo')
			  ),
			CALCULATE(
			  DISTINCTCOUNT('Hoja de Trabajo'[Hora]),
			  ALL('Hoja de Trabajo')
			),
		      0)

 

Right overall average volume per hourRight overall average volume per hour

Sean
Community Champion
Community Champion

Ok great I was just going to suggest you do that!

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.