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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sagarsahoo_123
Helper IV
Helper IV

AverageX is not working as expected when the cell is blank

Hi Team,

I have a small requirement. I want  to use AverageX function considering the blank cell when calculating.

For better explanation i am attaching a simple sample set below.

MonthTotal=(A+B)AB
Oct2 2
Nov2 2
Dec312
Expected Total2.3330.332

 

In this my total is combinaton of Column A and B. If you look at the column A is having 2 blank cell and 3rd cell for Dec month is 1.

When applying AverageX function selecting 3month in slicer like Oct,Nov, Dec it is giving me 1, but my expectation is as it has to consider the total value 1 against 3month. So i am expecting the result of Total for column A would be 0.33 .

How Can achieve this, please help!

 

Total = AVERAGEX(VALUES([Month]),sum[A])

 

Regards,

Sagar

1 ACCEPTED SOLUTION

Hi @amitchandak ,

Got a way to bring the expected result i am looking for. I converted the blank cell value as Zero, then AverageX considered for all selected months and provided the desired result.

 

Added the ISBLANK function to address the blank cell value.

--------------------------

Nippon HC = AVERAGEX(VALUES(FY_Calendar[Month]),
    IF(
        ISBLANK([Nippon HC_D1]),
        0,
        [Nippon HC_D1]
    )
  )
----------------------
Now for OND period the table is coming as per expectation.
sagarsahoo_123_0-1676180752648.png

Thanks a lot for your valuable inputs.

 

Regards,

Sagar

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@sagarsahoo_123 , Use calculate OR use measure in expression of sumx

 

Total = AVERAGEX(VALUES([Month]),calculate( sum[A]) ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

Thanks for your quick response. But calculate function is  already used in the measure but it is not giving the desired result for multiple month selection. The problem comes when the value for any month is blank.

 

please find the actual code used in the dashboard.

sagarsahoo_123_0-1676122398535.png

The above image is for the period of Oct to Dec. And in which both Nippon and Digi ACT HC count is <= Total HC. To bring average value for mulltiple month i have used AverageX function.

Code:-

Nippon HC = AVERAGEX(VALUES(FY_Calendar[Month]),[Nippon HC_D1])
Nippon HC_D1 = calculate(SUM(VW_NIPPON_PRODUCTIVITY[FTE]), NOT(ISBLANK(VW_NIPPON_PRODUCTIVITY[NIPPON_STATUS])))
--------------
Please find the image only selecting single month.
Selecting only Oct month.
sagarsahoo_123_1-1676122713633.png

Selecting only Nov month

sagarsahoo_123_2-1676122757131.png

Selecting Dec month

sagarsahoo_123_3-1676122801246.png

So single month selection, the value is coming correctly but problem comes when multiple month are selected and its average for Nippon HC is coming as 1, but it has to be 0.33 which is for 3 month. Though in Oct and Nov there is no value for Nippon HC but when averaging for all 3 months, it should consider the Oct and Nov as well.

 

Thanks for your support.

 

Regards,

Sagar

Hi @amitchandak ,

Got a way to bring the expected result i am looking for. I converted the blank cell value as Zero, then AverageX considered for all selected months and provided the desired result.

 

Added the ISBLANK function to address the blank cell value.

--------------------------

Nippon HC = AVERAGEX(VALUES(FY_Calendar[Month]),
    IF(
        ISBLANK([Nippon HC_D1]),
        0,
        [Nippon HC_D1]
    )
  )
----------------------
Now for OND period the table is coming as per expectation.
sagarsahoo_123_0-1676180752648.png

Thanks a lot for your valuable inputs.

 

Regards,

Sagar

@sagarsahoo_123 Thank you very much. Your formula worked for me!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors