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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Dicken
Continued Contributor
Continued Contributor

Average granularity


Hi, i have a  question iif  i have a fact tabel, over a copupe of years, but not all years have all months  , 
so example may start Feb  to Oct. 
   if i  want an average  total / 12  if    so  I have 3 measures ; 

Tunits:=SUMX(Table1,Table1[Units])

AvgXYM:=DIVIDE( [Tunits], 12)

Avgx:=AVERAGEX(VALUES('Calendar'[MMM-YYYY]),[Tunits])

 

where i just divide this works, but I don't know way the averagex does not,  the 'calendar' has all the months, yes still 
gives an average for number  in Table1 ?  , so  why ?  and can I make it 'see' all the months in the calendar table? }
This is being displayed in a Year only pivot table. 

Richard. 

1 ACCEPTED SOLUTION
v-sathmakuri
Community Support
Community Support

Hi @Dicken ,

 

May I ask if the provided solution helped in resolving the issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you!!

View solution in original post

5 REPLIES 5
v-sathmakuri
Community Support
Community Support

Hi @Dicken ,

 

May I ask if the provided solution helped in resolving the issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you!!

Dicken
Continued Contributor
Continued Contributor

Not really as I wanted a way to force it to include all months present in the calendar ,

reagardless of whether that month had a value in the fact table. 

danextian
Super User
Super User

Hi   

First, you don't need SUMX for this. Just go for regular SUM. Use SUMX if you want a calculation that SUM doesn't suport like Total Price =  SUMX ( tbl,  tbl[units] * tbl[unit sales price] )

Tunits:=SUMX(Table1,Table1[Units])

 

AVERAGEX may not be producing the expected result because it iterates through all visible distinct MMM-YYYY values. The number of unique values could be less than, equal to, or greater than 12. Additionally, your DIVIDE measure uses a constant value of 12. It's important to note that AVERAGEX will exclude any MMM-YYYY that lacks a value. For instance, if Apr-2025 has no value, the average will be computed based only on the remaining months. So, even if 12 months are currently visible, the actual calculation will be based on 11.

danextian_0-1748138312688.png

@Dicken





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Dicken
Continued Contributor
Continued Contributor

I think an approach, and I have not got this working , it to use parallelperiod,   so 

EVALUATE 
SELECTCOLUMNS( 
PARALLELPERIOD( 'Calendar'[Date],0,YEAR),
"N", FORMAT( 'Calendar'[Date],"MMM-YYYY") )

would give a single row table  to iterate over  and would conatain all dates, just an idea. 

Ashish_Excel
Super User
Super User

Hi,

Since you do not have data for all the months shown in the Calendar table, the average will only be for the months for which you have data in the Fact table.  You should just use the first 2 measures.  Also, simplify the first measure to

=sum(Table1[units])

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.