Microsoft Office Tutorials and References
In Depth Information
The first step in your analysis is solved—you now have a table that contains the basic
information you need to perform the simulation, and that data will be refreshed correctly whenever the
source data changes. It is now time to perform the courier simulation over this table, something
that is harder than expected.
A More Elegant Solution with CALCuLATE and EARLIER
For the brave reader, we have another solution to the same problem, which involves
your using the CALCULATE function with only one table (the OrderDetails table) to
perform the total weight per order computation. Using CALCULATE and the EARLIER
functions, you can summarize the total order weight with this formula:
= CALCULATE( SUM( OrderDetails[Weight] ),
ALL( OrderDetails ),
OrderDetails[OrderNumber] = EARLIER( OrderDetails[OrderNumber] ) )
This solution is easier to implement but requires of you a better understanding of the
DAX language. Because we believe that the solution presented before is easier to
understand, we provided that one first. Using CALCULATE and EARLIER is much harder
to understand, but it gives you a very elegant and neat solution like the one we just
Chapter 6, “Evaluation Context and CALCULATE.”