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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SebSchoon1
Post Patron
Post Patron

Total is not correct.

Hi Guys,

 

I have  a problem to understand use of context in DAX

 

here is my model

 

SebSchoon1_0-1663684517312.png

 

Where i have only one dim table (Base Article) and one fact Table (Tableau Dispatch)

 

Where i want To get Stock values per warehouse (Code depot) And the related dispatch priority (Rank Dispatch)

 

I'd like to have for the selected Brands (FOurnisseur principal)

 

The Total number of items in stock ( within any warehouse ) Divided by the Total number of Authorised Warehouses

 

Split the Quantity By integer and decimal

 

Get the Total Value of Decimals mulitplied by Total number of warehouses (to get another Integer)

 

And split that number By Rank dispatch

 

if(Total value of decimals <= to Rank dispatch , 1 , Blank())

 

I'am not able to deal with It.

 

I must Work even at The Item level AND at the Item Size level..

 

Days i'm on it !

 

 

 

 

 
 
 
 
1 ACCEPTED SOLUTION

Hi @SebSchoon1 ,

 

I can't open the link you provided for now, but for this type of problem, it should be a problem caused by the external filtering context in the created formula. Refer to the formula comparison in the following test.

Amount_filter = sum(FactInternetSales[SalesAmount])
Result1 =
VAR div2 =
    CALCULATE ( [Amount_filter], ALL ( DimProduct ) )
RETURN
    DIVIDE ( [Amount_filter], div2, BLANK () )

Result2 =
VAR div2 =
    CALCULATE ( [Amount_filter], ALLEXCEPT ( DimProduct, DimProduct[_ABC Class] ) )
RETURN
    DIVIDE ( [Amount_filter], div2, BLANK () )

vhenrykmstf_0-1664874595627.png

 

More details, you can read below blog:

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT - SQLBI

 

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

 

View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @SebSchoon1 ,

 

There should be an error in the total value caused by the external context filter condition. Can you provide a screenshot of the expected results and the test data with a description, so that I can answer you as soon as possible.

How to Get Your Question Answered Quickly - Microsoft Power BI Community

 

In the meantime, you can read the below blog about the behavior of the ALLxxx functions in DAX.

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT - SQLBI


Looking forward to your reply.


Best Regards,
Henry

 

Hi @v-henryk-mstf 

 

Sorry for the late reply,

 

Here is what i expect

 

CODE ARTICLECODE DEPOTTAILLERANK1-Total articles en stockTotal DépotsTotal quantités tous dépotsRépartitionPartie entièrePartie décimaleReliquat totalRépartition finale
DIF500ASP015 13351,6710,6722
DIF500ASP010 22351,6710,6722
DIF500ASP040 30351,6710,6721
LODSTICKS70WH015 16382,6720,6723
LODSTICKS70WH010 22382,6720,6723
LODSTICKS70WH040 30382,6720,6722
    133131394413

 

Here is what i Get for now 

SebSchoon1_0-1663838296827.png

I'm not able to manage calculations on different levels in Dax, it is quite frustrating..

 

Here is a link with sample

 

https://we.tl/t-KwOgHOZDJF

 

 

Thanks in advance 

 

 

 

Hi @SebSchoon1 ,

 

I can't open the link you provided for now, but for this type of problem, it should be a problem caused by the external filtering context in the created formula. Refer to the formula comparison in the following test.

Amount_filter = sum(FactInternetSales[SalesAmount])
Result1 =
VAR div2 =
    CALCULATE ( [Amount_filter], ALL ( DimProduct ) )
RETURN
    DIVIDE ( [Amount_filter], div2, BLANK () )

Result2 =
VAR div2 =
    CALCULATE ( [Amount_filter], ALLEXCEPT ( DimProduct, DimProduct[_ABC Class] ) )
RETURN
    DIVIDE ( [Amount_filter], div2, BLANK () )

vhenrykmstf_0-1664874595627.png

 

More details, you can read below blog:

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT - SQLBI

 

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.