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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
DuvCam
Regular Visitor

Hi ! -- Average of a Measure (defined itself from measures on 2 different tables) including BLANKS

Hi experts people !


I have looked extensively on existing posts to see if there was already answers to this (simple) situation but no success …
Hope you can help me !  😊


I am working with PowerPivot Tables and DAX Measures (all in Excel)

The data:
COSTS being an explicit measure, defined by a DAX formula (it is not a column in a table), computed as the sum of 2 other Measures (from 2 different tables)
PERIOD is a column in the DataTable

 

COSTSPERIOD    
Product2023_012023_022023_032023_04Grand Total
GER5,3787,4848,3946,66627,922
ROM 3,1633,8043,60910,576
NOR2677,6143,8606,16817,910
Grand Total5,64518,26216,05716,44456,408

 

The wanted result:
Computation of for each Product of the AVERAGE of the GRAND TOTAL (let's call this wanted result "Average_GT")
In our case there are 4 periods with data => the average should be done for 4 periods => i.e. the GRAND TOTAL for each Product divided by number of period (with data for any of the Product)
=> what would be the DAX formula to define the Measure "Average_GT" ? Impossible so far to obtain this result …  ☹️

 

 Average_GT  
Product   
GER6,980 Average computed on 4 months
ROM2,644 Average computed on 4 months
NOR4,477 Average computed on 4 months
Grand Total14,102  

 

Obtained so far:
Using the AVERAGEX formula allows to compute the Average, but it excludes the empty cells:

 

DynamicAverage = AVERAGEX(VALUES(Master_Calendar_Fiscal_Periods[PERIOD]), [COSTS])

 

 

 DynamicAverageDynamicAverage#2  
Product    
GER6,9806,980 Average computed on 4 months: OK
ROM3,5253,525 Average computed on 3 months: Not OK !!
NOR4,4774,477 Average computed on 4 months: OK
Grand Total14,10214,102  

 

I get the same result if trying:

 

DynamicAverage#2 = AVERAGEX( CALCULATETABLE(  VALUES (Master_Calendar_Fiscal_Periods[PERIOD] ) , ALL (Data_Table[Product])) , [COSTS])

 

 

Many thanks in advance for any help ! Any question let me know!

Camille

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @DuvCam 

 

You can try the following methods.

Measure = 
Var _Sum=CALCULATE(SUM('Table'[COSTS]),ALLEXCEPT('Table','Table'[Product]))
Var _Count=CALCULATE(DISTINCTCOUNT('Table'[PERIOD]),ALL('Table'))
Return
DIVIDE(_Sum,_Count)

vzhangti_0-1683858210746.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-zhangti ,
Thank you for your feedback.
Proposed solution tested and not working unfortunately.
1/ For _Sum: my COSTS is a measure, not a cloumn, therefore proposed function SUM not working => I get around this with SUMX function. We should be OK here.
2/ For _Count: challenge is that my measure COSTS is defined from 2 different measures belonging to 2 different tables "Table" (the same as where COSTS is defined) and "Table2".
I am modifying the definition of _Count to:

 

Var _Count=CALCULATE(DISTINCTCOUNT('Table'[PERIOD]),ALL('Table')) + CALCULATE(DISTINCTCOUNT('Table'[PERIOD]),ALL('Table2'))

 

 The returned result is unfortunately a 3 for the Product "ROM", instead of the 4 that would allow to compute the expected average.

Product_Count (obtained)_Count (expected)
GER44
NOR44
ROM34
TOTAL44

 

Let me know if I have mis-understood / mis-tried one of the steps, otherwise most grateful for any other suggestions ! 😊

Hi, @DuvCam 

 

You can try the following methods.

Count = 
Var _table=DISTINCT(UNION(VALUES('Table'[PERIOD]),VALUES('Table 2'[PERIOD])))
Var _count=COUNTROWS(_table)
Return
_count

vzhangti_0-1683876262850.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @v-zhangti ,
Thanks for the further feedback.
Trying the new suggestion, I unfortunately still obtain an incorrect value of 3 for product ROM.

Product_Count (obtained)
GER4
NOR4
ROM3
TOTAL4

Any other suggestion ?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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