cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## Calculate Cumulative Average Overtime

Hi Community,

Need help to calculate cumulative average price per product overtime (since product started to be sold. I can have different dates for different products).

Fact Table

 Product Date [Total Sales] [Quantity] A 31/1/2022 150 3 A 5/5/2022 100 4 A 6/5/2022 10 1 B 30/1/2024 150 6 B 2/2/2024 100 3 C 30/5/2023 100 2 C 5/7/2023 150 2 D 6/6/2022 300 2

I would like to have a measure to be applied in a matrix visual that has a page Date Slicer.

Despite date applied in the slicer, it should show always the Cumulative Average Overtime Measure as follows:

Output for measure:

A - 32.50

B - 27.78

C - 62.50

D - 150

1 ACCEPTED SOLUTION
Community Support

Hi @yellow43 ,

Based on my testing, please try the following methods:

1.Create the simple table.

2.Create the new measure to calculate cumulative average.

``````average_over =
VAR product_sales = CALCULATE(SUM('Fact Table'[Total sales]), ALLEXCEPT('Fact Table', 'Fact Table'[Product]))
VAR product_quantity = CALCULATE(SUM('Fact Table'[Quantity]), ALLEXCEPT('Fact Table', 'Fact Table'[Product]))
RETURN
DIVIDE(product_sales, product_quantity)``````

3.Drag the measure into the matrix visual. The result is shown below.

Best Regards,

Wisdom Wu

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

2 REPLIES 2
Helper I

Thank you @v-jiewu-msft

Community Support

Hi @yellow43 ,

Based on my testing, please try the following methods:

1.Create the simple table.

2.Create the new measure to calculate cumulative average.

``````average_over =
VAR product_sales = CALCULATE(SUM('Fact Table'[Total sales]), ALLEXCEPT('Fact Table', 'Fact Table'[Product]))
VAR product_quantity = CALCULATE(SUM('Fact Table'[Quantity]), ALLEXCEPT('Fact Table', 'Fact Table'[Product]))
RETURN
DIVIDE(product_sales, product_quantity)``````

3.Drag the measure into the matrix visual. The result is shown below.

Best Regards,

Wisdom Wu

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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors