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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
jcastr02
Post Prodigy
Post Prodigy

Avg number of items per month (only last completed month)

I am trying to do an avg number of records per month but I only want it to count through the last complete month.  In other words, if today is 11/8/2024, I want it to only    count records through 10/31/2024.  

My table has below two columns

RecordID           Created           

1 ACCEPTED SOLUTION
saud968
Impactful Individual
Impactful Individual

To calculate the average number of records per month up to the last completed month in Power BI, you can follow these steps:

Create a new column to extract the month and year from the Created column:
MonthYear = FORMAT('YourTable'[Created], "YYYY-MM")

Create a measure to count the records up to the last completed month:
TotalRecords =
CALCULATE(
COUNT('YourTable'[RecordID]),
'YourTable'[Created] < EOMONTH(TODAY(), -1) + 1
)

Create a measure to count the distinct months up to the last completed month:
DistinctMonths =
CALCULATE(
DISTINCTCOUNT('YourTable'[MonthYear]),
'YourTable'[Created] < EOMONTH(TODAY(), -1) + 1
)

Create a measure to calculate the average number of records per month:
AvgRecordsPerMonth =
DIVIDE([TotalRecords], [DistinctMonths])

Replace 'YourTable' with the actual name of your table. These steps will give you the average number of records per month up to October 31, 2024.

Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!

View solution in original post

1 REPLY 1
saud968
Impactful Individual
Impactful Individual

To calculate the average number of records per month up to the last completed month in Power BI, you can follow these steps:

Create a new column to extract the month and year from the Created column:
MonthYear = FORMAT('YourTable'[Created], "YYYY-MM")

Create a measure to count the records up to the last completed month:
TotalRecords =
CALCULATE(
COUNT('YourTable'[RecordID]),
'YourTable'[Created] < EOMONTH(TODAY(), -1) + 1
)

Create a measure to count the distinct months up to the last completed month:
DistinctMonths =
CALCULATE(
DISTINCTCOUNT('YourTable'[MonthYear]),
'YourTable'[Created] < EOMONTH(TODAY(), -1) + 1
)

Create a measure to calculate the average number of records per month:
AvgRecordsPerMonth =
DIVIDE([TotalRecords], [DistinctMonths])

Replace 'YourTable' with the actual name of your table. These steps will give you the average number of records per month up to October 31, 2024.

Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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