Forum Discussion
Average calculation
- 2 years ago
Anonymous
I rewrote it to use a couple measures.
1. Just the count of records.
Matter Key Count = COUNT( 'WL Matter Extract'[MATTER_KEY] )2. A YTD running total of that count
Cummulative Count = CALCULATE ( [Matter Key Count], DATESYTD ( 'Calendar Date'[Date] ) )3. A YTD active months count. Only count months that have records in the 'WL Matter Extract' table
Cummulative Month Count = CALCULATE ( COUNTROWS ( CALCULATETABLE ( VALUES ( 'Calendar Date'[Month Year] ), 'WL Matter Extract' ) ), DATESYTD ( 'Calendar Date'[Date] ) )The Avg measure, where I only show the amount on months that have records to keep it from rolling forward to all future moths in the year.
Avg = VAR _Count = [Matter Key Count] VAR _YTDCount = [Cummulative Count] VAR _Months = [Cummulative Month Count] RETURN DIVIDE ( _Count, _Count ) * DIVIDE ( _YTDCount, _Months )I have attached my sample file for you to look at.
Anonymous
I rewrote it to use a couple measures.
1. Just the count of records.
Matter Key Count = COUNT( 'WL Matter Extract'[MATTER_KEY] )
2. A YTD running total of that count
Cummulative Count =
CALCULATE ( [Matter Key Count], DATESYTD ( 'Calendar Date'[Date] ) )
3. A YTD active months count. Only count months that have records in the 'WL Matter Extract' table
Cummulative Month Count =
CALCULATE (
COUNTROWS (
CALCULATETABLE (
VALUES ( 'Calendar Date'[Month Year] ),
'WL Matter Extract'
)
),
DATESYTD ( 'Calendar Date'[Date] )
)
The Avg measure, where I only show the amount on months that have records to keep it from rolling forward to all future moths in the year.
Avg =
VAR _Count = [Matter Key Count]
VAR _YTDCount = [Cummulative Count]
VAR _Months = [Cummulative Month Count]
RETURN DIVIDE ( _Count, _Count ) * DIVIDE ( _YTDCount, _Months )
I have attached my sample file for you to look at.
Hi jdbuchanan71
Thanks a lot
It worked 🙂