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
GenericUser1
Helper I
Helper I

Does anyone know how to calculate a measure with only the months that have data in it?

I have data from March to August. Every other month is missing data. I want to look for the average number of tickets per month as a KPI but only with the months with data in it. 

6 REPLIES 6
v-yuta-msft
Community Support
Community Support

Hi GenericUser1,

 

As a general solution, you may create a measure using DAX like pattern below and check if it can meet your requirement:

 

Average Value Per Month =
CALCULATE (
    AVERAGE ( Table[Number of Tickets] ),
    ALLEXCEPT ( Table, Table[Month] )
)

Regards,

Jimmy Tao

 

 

This dax for some reason is returning the total number of tickets I have. The average should be around 30 something per month but I don't know how to get there without including months with no data in it.  

 

AverageTicketsPerMonth = CALCULATE(
average(incidents[Number Of Tickets Column]),
allexcept('Calendar Date', 'Calendar Date'[MonthShort]

 

result:

341. 

Is your MonthShort column by chance being sorted by another column? If so, include that column in your ALLEXCEPT as well.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

This dax for some reason is returning the total number of tickets I have. The average should be around 30 something per month but I don't know how to get there without including months with no data in it.  

 

AverageTicketsPerMonth = CALCULATE(
average(incidents[Number Of Tickets Column]),
allexcept('Calendar Date', 'Calendar Date'[MonthShort]

 

result:

341. 

edhans
Super User
Super User

The AVERAGE() function ignores missing data. I just put test data in January, March, and July. Then I connected it to my Date table. Dropped teh month from the date table into a Table, then created this measure:

=AVERAGE(Tickets[Records])

The grid shrank to three rows - Jan/Mar/Jul, and hte average that was calculated is accurate.

I did not try this without a Date table. I alwys have a date table in my model.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Good suggestion but I was hoping to use the average per month as a KPI so not in bar graph. I'm not looking for average in January, February etc... Just a general average per month if you get what I mean so using a card visual to check the overall average per month. 

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.