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
QBSRL
New Member

AVERAGE on rows in matrix

Hi,

 

I'm new in Power Bi, and I can't use the AVERAGE function correctly.

So, I have this hierarchy in matrix:

 

QBSRL_0-1610976182261.png

 

First, please explain me, how is calculate first column, 3.20? I have value SOACTION_DURATA_PVC and I choose "Average".

I expected it to look like this: 4+2+2 = 8, then 8/3 (because I have 3 rows) = 2.66.

So, because display 3.20... I counted the rows separately with distinct count, column AP. 3 it's correct.

Then, column CONS it's a measure, I want 4+2+2 = 8 / 3 = 2.66.

I tried this:

CONS = DIVIDE(AVERAGE('BI TICKETE_HEADER'[SOACTION_DURATA_PVC]),'BI TICKETE_HEADER'[AP])

And I tried this:
CONS = CALCULATE(DIVIDE(
CALCULATE(AVERAGEX('BI TICKETE_HEADER','BI TICKETE_HEADER'[SOACTION_DURATA_PVC]))
,'BI TICKETE_HEADER'[AP]))
But it doesn't work.. I really don't know why display 3.20 or 1.07. I don't understand how it calculates.
Please, any help?
 
Thank you!

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

I don't know the name of your lowest level column (the one with ETA J3, ETA J7, etc.) but you can use that in a measure like this.  

 

NewMeasure =
AVERAGEX (
    VALUES ( Table[ColumnWithETA] ),
    CALCULATE (
        AVERAGE ( Table[Soaction_Durata_PVC] )
    )
)

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
QBSRL
New Member

@mahoneypat It Works! Thank you a looooott! You saved me.

 

There is the possibility when I collapse level, calculate again?

 

So, now it's correct here: column AVG

Capture3.JPG

But here, collapse, I want :
column AVG = 1+2.67+14+3+34+1+7.67 = 63.34 / 7 rows = 9.04, not 7.64.Capture2.JPG

 

Thank you!

You can try two approaches for that.  Try the first one first as it will be more performant but you may need the second to get your results.

 

First =
AVERAGEX (
    SUMMARIZE (
        Table,
        Table[BlocColumn],
        Table[ETAColumn]
    ),
    CALCULATE (
        AVERAGE ( Table[Soaction_Durata_PVC] )
    )
)

 

Second =
AVERAGEX (
    VALUES ( Table[BlocColumn] ),
    AVERAGEX (
        VALUES ( Table[ETAColumn] ),
        CALCULATE (
            AVERAGE ( Table[Soaction_Durata_PVC] )
        )
    )
)

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you a lot! 

The second solution worked.

 

Thank you again! Have a nice day!

mahoneypat
Employee
Employee

I don't know the name of your lowest level column (the one with ETA J3, ETA J7, etc.) but you can use that in a measure like this.  

 

NewMeasure =
AVERAGEX (
    VALUES ( Table[ColumnWithETA] ),
    CALCULATE (
        AVERAGE ( Table[Soaction_Durata_PVC] )
    )
)

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.