Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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
Thanks in advance.
Solved! Go to Solution.
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.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
12 | |
10 | |
10 | |
8 |
User | Count |
---|---|
16 | |
15 | |
14 | |
13 | |
10 |