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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi Guys,
I have a problem to understand use of context in DAX
here is my model
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 !
Solved! Go to 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 () )
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.
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
Sorry for the late reply,
Here is what i expect
| CODE ARTICLE | CODE DEPOT | TAILLE | RANK | 1-Total articles en stock | Total Dépots | Total quantités tous dépots | Répartition | Partie entière | Partie décimale | Reliquat total | Répartition finale |
| DIF500ASP | 015 | 1 | 3 | 3 | 5 | 1,67 | 1 | 0,67 | 2 | 2 | |
| DIF500ASP | 010 | 2 | 2 | 3 | 5 | 1,67 | 1 | 0,67 | 2 | 2 | |
| DIF500ASP | 040 | 3 | 0 | 3 | 5 | 1,67 | 1 | 0,67 | 2 | 1 | |
| LODSTICKS70WH | 015 | 1 | 6 | 3 | 8 | 2,67 | 2 | 0,67 | 2 | 3 | |
| LODSTICKS70WH | 010 | 2 | 2 | 3 | 8 | 2,67 | 2 | 0,67 | 2 | 3 | |
| LODSTICKS70WH | 040 | 3 | 0 | 3 | 8 | 2,67 | 2 | 0,67 | 2 | 2 | |
| 13 | 3 | 13 | 13 | 9 | 4 | 4 | 13 |
Here is what i Get for now
I'm not able to manage calculations on different levels in Dax, it is quite frustrating..
Here is a link with sample
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 () )
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |