Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cheeto92
Frequent Visitor

Power BI DAX

Hi Everyone,

 

I have a chart that shows the work order volume by month. There are two columns being used in the chart -> the date column and the Request ID column they both come from the Work Order table.

I try to do a cumulative average across the months and i'm getting the wrong average. Its basically calculating the actual request id number and not the count. ANy help please?

cheeto92_0-1712761421098.png 

cheeto92_1-1712761436965.png

 

 

1 ACCEPTED SOLUTION
ToddChitt
Super User
Super User

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)




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
ToddChitt
Super User
Super User

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)




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





ToddChitt
Super User
Super User

What number are you expecting to see for each month of the chart? Do you want a 'constant (flat) line' at:

( 312  + 349 + 327 + 148 ) / 4 ? = 284




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Hi Todd,

 

i am expecting to see that 284. I want the Dax to be dynamic to take in more months as i keep going into the year as well.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.