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

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

Reply
nanma94
Helper III
Helper III

summarize not considering blank rows

I have a dax that calculate the average sales of selected sales team - summarize will not return a record for territories that have no revenue, though in below its checking 0 and null. I need these 0 value territories to be included otherwise the average is inflated. In the data model, "sales" is the fact table that glues all the dimension tables. So 

 

M_Rev_DisplayAvg =

var Vals = CALCULATETABLE(
                     ADDCOLUMNS (
                         SUMMARIZE(Sales,
                                              SalesHier[Territory Name],
                                              DateTable[Year-Mon],
                                              'Prod Mapping - MaterialOrSegment'[MBR Financials]),
                    "Rev", if([M_TotalRevPlanRate]=0 || ISBLANK([M_TotalRevPlanRate]), 0, [M_TotalRevPlanRate])),
                 ALLSELECTED ())

 

VAR AvgValue = AVERAGEX ( Vals, [Rev] )

Return AvgValue

 

 

Thank you so much in advance!
NM

6 REPLIES 6
v-lionel-msft
Community Support
Community Support

Hi @nanma94 ,

 

Has your problem been solved?

 

Best regards,
Lionel Chen

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

az38
Community Champion
Community Champion

Hi @nanma94 

I don't like ypur summarize statement

SUMMARIZE(Sales,
                                              SalesHier[Territory Name],
                                              DateTable[Year-Mon],
                                              'Prod Mapping - MaterialOrSegment'[MBR Financials])

It should have a little bit other syntax https://docs.microsoft.com/en-us/dax/summarize-function-dax

it has no "name" argument


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38Thank you! I will add the names. But will the names fix the issue... 🙂

az38
Community Champion
Community Champion

@nanma94 

as I understand its name "M_TotalRevPlanRate"?

why do you need calculatetable?

M_Rev_DisplayAvg =

var Vals = 
                     ADDCOLUMNS (
                         SUMMARIZE(Sales,
                                              SalesHier[Territory Name],
                                              DateTable[Year-Mon],
                                              "M_TotalRevPlanRate",
                                              'Prod Mapping - MaterialOrSegment'[MBR Financials]),
                    "Rev", if(ISBLANK([M_TotalRevPlanRate]), 0, [M_TotalRevPlanRate]))
                
VAR AvgValue = AVERAGEX ( Vals, [Rev] )

Return AvgValue

works pretty good for my dummy data


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38  because I have a whole set of external slicers, so using calcualtetable, I am adding   ALLSELECTED ()) to keep the extenal filters. would this make sense?

 

[M_TotalRevPlanRate] is an existing measure to sum up sales revenue. 

 

Hi @nanma94 ,

 

The reason for the error is the following step.

 if([M_TotalRevPlanRate]=0 || ISBLANK([M_TotalRevPlanRate]), 0, [M_TotalRevPlanRate])

Since the [M_TotalRevPlanRate] is a measure, it's very easy to be wrong to use conditional judgment statements and summaries on it.

The easiest way is to change this measure to a calculated column.

 

Would you mind sharing your .pbix file?

 

Best regards,
Lionel Chen

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

 

 

 

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Kudoed Authors