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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
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:
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
Solved! Go to Solution.
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.
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] )
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.
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] )
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!
I think that @jesusbritog means blank value and don't mean Products 2.
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!
User | Count |
---|---|
9 | |
8 | |
5 | |
4 | |
3 |