Forum Discussion
Power BI DAX
- 2 years ago
OK. I think we can get close.
Unfortunately there is a limitation that you cannot use a Measure as a Constant Line on a chart. But we can probably get around that.
Try this:
Create a measure that is [Monthly Count] = COUNTROWS('Work Order table')
Create a measure that is [Count of Months] = COUNTDISTINCT ( MONTH ( 'Work Order table'[Date]) )
Create a measure that is [Monthly Average] = DIVIDE ( [Monthly Count], [Count of Months], 0 )
That will get you close, but know that January 2024 (month = 1) will be treated the same as January 2023 (also month = 1). You may need an intermediate column: [YYYYMM] = YEAR ( [some date] ) * 100 + MONTH ( [some date] ). Do your [Count of Months] on that column)
OK. I think we can get close.
Unfortunately there is a limitation that you cannot use a Measure as a Constant Line on a chart. But we can probably get around that.
Try this:
Create a measure that is [Monthly Count] = COUNTROWS('Work Order table')
Create a measure that is [Count of Months] = COUNTDISTINCT ( MONTH ( 'Work Order table'[Date]) )
Create a measure that is [Monthly Average] = DIVIDE ( [Monthly Count], [Count of Months], 0 )
That will get you close, but know that January 2024 (month = 1) will be treated the same as January 2023 (also month = 1). You may need an intermediate column: [YYYYMM] = YEAR ( [some date] ) * 100 + MONTH ( [some date] ). Do your [Count of Months] on that column)