The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I'm trying to create a measure for a matrix table that is the average of a running sum.
I have a running sum calculated in a Matrix table, but I seem unable to create a measure to provide the average of this running sum, in the the Matrix table, which can summarize (provide the average) by day, month, year.
This is not an issue using static data, as the DAX expression AVERAGE works as expected. The issue arrizes when I'm trying to average a the outcome of a measure (and specifically a measure that is a running sum / total).
To illustrate, I'll start with static data, which provides the desired outcome, followed by another example but replacing the running sum (static) column a measure that calculates the running sum. I've provided the incorrect solution below as well. It's this second example that I need help with.
Using static data for Gross Adds, Terminations, Net Adds and Ending Customers, I can create the following Matrix (note that Ending Customers is a running sum, by date, of Net Adds, but I've made it static data in this first example below)
AccountInfo2
Matrix2 - This is the correct, desired outcome: Average Customers is the true average of EndingCustomers
DAX
@emilhizer This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149
The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.
Greg, thanks for the reply - I followed the instructions / pattern noted in your reply and in your linked article, however, I'm not getting the average over the period (day, month, year) in the matrix, rather my average is only showing the last value (customer) in the period. Nothing seems to be averaging.
Thoughts - remember, I'm trying to take the average of a cumulative sum measure. The cumulative sum (ending customers) below is working fine, but as you can see, the Average Customers measure isn't the average of the Ending Customers for each period (day, month, year). See my original information above for what the expected average is.
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |