Mastering DAX Class Calcs: Labs

Questions regarding the class Mastering DAX Calculations.

In the Basic Labs Module, are the “solutions” really correct. How can a measure for Sales (i.e., Total Sales would normally be UnitPrice * Quantity).

Am I missing something…?

Sales = // ??? how can this be correct?
SUMX(Sales,
Sales[UnitCost] * Sales[UnitPrice]
)

Thanks for the quick reply, but (except for the comment that I added) this is the “answer” straight from EDNA.

Again, if the goal is to get a total of sales for each row (i.e., SUMX), then why wouldn’t it be … Number of Items X SalesPrices per Item (or UnitPrice*UnitQuantity, to use the column names in the data model.)

What does UnitCost * UnitPrice mean in reality…?

Yeah,

Sales =
SUMX (
    Sales,
    Sales[Quantity] * Sales[Net Price]
// Net Price = Unit Price - Discount Amount
)

Thank you for following up. But I still don’t understand.

Put another way: Are you saying that the answer given in EDNA’s “solution” is correct or incorrect? All I have done is paste in EDNA’s measure in this forum. (And I do understand that there are often several ways to do the same thing). If, by chance, the EDNA “solution” measure is incorrect, how do I get someone’s attention to get it fixed?

I may have to dive into the data my own way, probably using a simple, small sample set. UnitPrice * UnitCost still doesn’t make sense… Isn’t there a way to get to this Contoso dataset (I can’t from the PBIX file; and online I can get 2013+, etc. data not the 2011-ish data used in the lab exercise).

For example, when I go back thru the Mastering DAX videos and the measures that Sam uses for teaching examples…he clear uses Quantity * Price, not Cost * Price…

Example provided here. It’s SumX iterated over Quantity * Cost (BTW: not wrapped in a Calculate measure).

Total Costs =
SUMX( Sales,
Sales[Order Quantity] * Sales[Total Unit Cost]
)

Thanks again for your time.

Thanks to both GuyJohnson and AnktrikshSharma.

And yes, AnktrikshSharma, your measure looks correct to me. And yes, there should be some adjustments so SalesPrice meaning that NetPrice is best (accounting for discounts, returns, etc.): I didn’t dive into that part of the issue. Thank you for the added clarification.

Bottom LIne: Is the measure as provided in “Solutions” Lab Assessment (Mastering DAX Calc’s) correct? It seems and answer is, “no”.

And if not, then can it be corrected–how do we get EDNA to do that? (I’m still figuring out how to best work within the EDNA Forum).

Again, thanks all.

GuyJohnson and/or AnktrikshSharma and/or others: Since the “directions” are to keep each post focused on a single questions…I have other separate questions posted today regarding the Mastering DAX resources If you have moment, pls look at those, too.

Again: thanks very much for responding, engaging.

@bgillaspey1 The formula concept is correct that you have to use SUMX to iterate over different rows. The field chosen Unit cost is not correct as it should have been quantity. It will be fixed soon.

Thanks for noticing it!

3 Likes

Thanks for answering this query @MudassirAli

Hi @bgillaspey1, was Mudassir able to provide the answer you were looking for?

Hi @bgillaspey1, I believe the issue has been answered by @MudassirAli. We will be tagging this post as solved. For further inquiry about the Labs, you may create a new post so we can easily respond to your concern. Thanks