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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mp390988
Helper V
Helper V

Calculate Average Transactions Per Year

Hi,

 

I have the below visual and as you can see, my last column "Average Transactions Per Year" is meant to display the average over the year. So for example, for the year 2011 it should display =9830/9=1092.22 everywhere where year =2011 regardless of the month

 

mp390988_0-1686680674710.png

 

I tried to create a mesaure called Average Transactions Per Year defined as follows:

 

Average Transactions Per Year =  CALCULATE(AVERAGEX(FactTable_Transaction,COUNTROWS(FactTable_Transaction)))  
 
The Month and Year fields come from my table called Calendar.
 
Can someone please help?
 
Thank You in advance
3 REPLIES 3
mp390988
Helper V
Helper V

Thank you for the reply!

 

I am confused. I don't understand the significance of this.

 

FILTER ( ALL ( 'Calendar' ), 'Calendar'[Year] = MAX ( 'Calendar'[Year] ) 

 
When I execute this in DAX studio it gives me this:

 

mp390988_0-1686750733764.png


which is the same as:

SUMMARIZE (
    'Calendar',
    'Calendar'[Month],
    'Calendar'[Month Num]
)

 

mp390988_1-1686750983308.png

 

Hi,

Thank you for your message.

I think the difference is the filter context that is existing, and that is applied to the each row in the visualization.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Jihwan_Kim
Super User
Super User

Hi, I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_1-1686712739480.png

 

 

Jihwan_Kim_0-1686712704075.png

 

# transaction measure: = 
SUM(Data[Number of Transaction])

 

Avg transaction per year measure: =
IF (
    NOT ISBLANK ( [# transaction measure:] ) && HASONEVALUE ( 'Calendar'[Year] ),
    AVERAGEX (
        SUMMARIZE (
            FILTER ( ALL ( 'Calendar' ), 'Calendar'[Year] = MAX ( 'Calendar'[Year] ) ),
            'Calendar'[Month name],
            'Calendar'[Month number]
        ),
        CALCULATE ( SUM ( Data[Number of Transaction] ) )
    )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.