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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
jesusbritog
Regular Visitor

How to exclude single cell from a column to calculate total

Hi everyone,

Before starting thanks for the support. I have these tables: sales, products, stores, and one table with exceptions, which means a product is not going to be sold in a particular store, below the structure:

otra pregunta power bi.jpg

My question is, how can I in a matrix don't take the value for Product 2, and store 4 (an exception)  to calculate the Avg total, in this case, the result must be 28, not 19 because product 2 is not for sale at the store 4, is it possible in the matrix? or using DAX?.

 

Thanks a lot for the support and time,

Regards

 

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Untitled.png

 

Sales avg: =
VAR _alltable =
    ADDCOLUMNS (
        SUMMARIZE ( Sales, 'Product'[Product], Store[Store] ),
        "@salesavg", CALCULATE ( AVERAGE ( Sales[Sales] ) )
    )
VAR _exceptiontable =
    ADDCOLUMNS (
        FILTER (
            SUMMARIZE ( Sales, 'Product'[Product], Store[Store] ),
            'Product'[Product] = "Product2"
                && Store[Store] = "Store4"
        ),
        "@salesavg", CALCULATE ( AVERAGE ( Sales[Sales] ) )
    )
VAR _returntable =
    EXCEPT ( _alltable, _exceptiontable )
RETURN
    AVERAGEX ( _returntable, [@salesavg] )

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

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Untitled.png

 

Sales avg: =
VAR _alltable =
    ADDCOLUMNS (
        SUMMARIZE ( Sales, 'Product'[Product], Store[Store] ),
        "@salesavg", CALCULATE ( AVERAGE ( Sales[Sales] ) )
    )
VAR _exceptiontable =
    ADDCOLUMNS (
        FILTER (
            SUMMARIZE ( Sales, 'Product'[Product], Store[Store] ),
            'Product'[Product] = "Product2"
                && Store[Store] = "Store4"
        ),
        "@salesavg", CALCULATE ( AVERAGE ( Sales[Sales] ) )
    )
VAR _returntable =
    EXCEPT ( _alltable, _exceptiontable )
RETURN
    AVERAGEX ( _returntable, [@salesavg] )

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

Hi @Jihwan_Kim , thanks a lot!, just a couple of questions:

1 - could be Exceptions table a isolated table right? I mean, not neccesary related to product table in the model.

2 - The sales table could have more than 160 million rows, is this a problem for that measure?

Again I really apreciate your support! 

technolog
Super User
Super User

Hi!

You can try create measure like this:

Store4Average = AVERAGEX( 'Table', DIVIDE (SUM('Table'[store4] ) , COUNTROWS( FILTER( 'Table' , 'Table'[store 4] <> BLANK () ) ) )

Thanks a lot @technolog , but it is more like the other solution!, I apreciate your support!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.