cancel
Showing results 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.

Helper I

## Average Accumulated as a measure

Hello friends.

I need to calculate the average acomulated as a measure to be able to use it in a pivoting matrix (measure), I want to have it as a measure and not creating a calculated column, please need help.

Best greetings.

1 ACCEPTED SOLUTION
Community Champion

@rmcneish

Hi, try with this measure:

```Measure =
VAR THEORDER =
SELECTEDVALUE ( ESPERA[ORDER] )
RETURN
AVERAGEX (
SUMMARIZE (
FILTER (
CROSSJOIN ( ALLSELECTED ( ESPERA[ORDER] ); VALUES ( ESPERA[PLANT] ) );
ESPERA[ORDER] <= THEORDER
);
"AVG"; AVERAGE ( ESPERA[HOURS] )
);
[AVG]
)
```

Regards

Victor

Lima - Peru

Lima - Peru
12 REPLIES 12
Helper I

My buddies.

I want to create a measure to use it in a matrix or different line charts.

I attach my file in One Drive.

https://tasaomega-my.sharepoint.com/:u:/g/personal/rnina_tasa_com_pe/EdkS5qs_VTVIkxHA1HV4hWABFNH1CLN...

Grettings.

@Anonymous

Anonymous
Not applicable

Hi @rmcneish,

Do you need a measure for average hours per order?

Helper I

Hi @Anonymous

Yes, respecting the order.

Anonymous
Not applicable

Hi @rmcneish,

Could you try Calculate(average(Table[Hours]), Groupby(Table, Table[Order]))

Helper I

Hi @Anonymous

I try the solution you gave me but the average is the same.

`Accumulated = CALCULATE(AVERAGE(ESPERA[HOURS]),GROUPBY(ESPERA,ESPERA[ORDER]))`

Anonymous
Not applicable

Hi @rmcneish,

I am a little confused. If you wish to see the output as in your first screenshot, you need to remove "Plant" from the matrix.

Helper I

Hi @Anonymous

The reuslt is the same.

}

Consult the attached file .pbi please.

https://tasaomega-my.sharepoint.com/:u:/g/personal/rnina_tasa_com_pe/EdkS5qs_VTVIkxHA1HV4hWABFNH1CLNNgebCfSg6QV4rfg?e=FATpQK

Anonymous
Not applicable

Hi @rmcneish,

Try Accumulated = ROUNDUP(CALCULATE(AVERAGE(ESPERA[HOURS]),GROUPBY(ESPERA,ESPERA[ORDER])),1)

and then in the modelling tab, change the format to Decimal number and decimal points to 1.

Is this what you need?

Helper I

Hi @Anonymous

Thnks for your great support and i valur so much your help, but i wish calculate the accumulated average in any selection of my filters ("#BOARD" and "PLANT").

In the next tablle I show the real calculated by all #BOATS and all  PLANTS

Sorry I'm annoying.

Anonymous
Not applicable

Oh I think I get it now 🙂 I think you would have to a table only with order ids and accumulated hours.

Table = DISTINCT(ESPERA[ORDER])

Then create a measure for accumulated hours

Accumulated Hours = Calculate(AVERAGE(ESPERA[HOURS]), filter(ESPERA, ESPERA[ORDER] = 'Table'[ORDER]))

You can also join this table with ESPERA table using order id as primary key.

Community Champion

@rmcneish

Hi, try with this measure:

```Measure =
VAR THEORDER =
SELECTEDVALUE ( ESPERA[ORDER] )
RETURN
AVERAGEX (
SUMMARIZE (
FILTER (
CROSSJOIN ( ALLSELECTED ( ESPERA[ORDER] ); VALUES ( ESPERA[PLANT] ) );
ESPERA[ORDER] <= THEORDER
);
"AVG"; AVERAGE ( ESPERA[HOURS] )
);
[AVG]
)
```

Regards

Victor

Lima - Peru

Lima - Peru
Helper I

Hola @VvelardeMe sirvió de mucho.

Gracias.

Announcements

#### 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

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors