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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
jamesrr25
Frequent Visitor

Calculated Column by distinct month

 Hello, I am attempting to create a calculated column to indicate the average of Rate by Month. I believe it should look something similar to the following, but I know the expression in the filter function is incorrect.

 

=Average(Filter('datamodel',[Month] = [Month]),[Rate])

 

What I am trying to do with this expression in the filter function is indicate that we only want the average for each distinct month. The bolded portion of the function is where I believe I am going wrong here and could use some assistance.

 

FYI - I have seen examples of this function with the month indicated, but I will not be able to do so with my example. The formula just needs to know that it takes the average of Rate in the 'datamodel' for a distinct month.

 

Thank you!

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @jamesrr25

 

Please try this

 

Column = CALCULATE(
                AVERAGE([Rate]) , 
                Filter('datamodel','datamodel'[Month] = EARLIER('datamodel'[Month])
                )
        )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @jamesrr25

 

Please try this

 

Column = CALCULATE(
                AVERAGE([Rate]) , 
                Filter('datamodel','datamodel'[Month] = EARLIER('datamodel'[Month])
                )
        )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thank you @Phil_Seamark ! This worked perfectly.

 

I have never used the Earlier function and am reading up on it some more. Very interesting! Have a fantastic day.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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