Forum Discussion
Which DAX functions are correct?
- 3 years ago
Anonymous Well, no sane human being would construct that measure that way. All you need to do is MAXX(FilterSegment,[Transaction Size]). You have to read up on CALCULATE extremely closely to understand why this works: CALCULATE – DAX Guide. Some CALCULATE only DAX try hard worked overtime to get CALCULATE into that formula. It's utter nonsense. But, because CALCULATE evaluates the 'Transaction Size'[Transaction Size] within the context of FilterSegment, which is a single row table, then the DISTINCT brings back a single row table of the [Transaction Size] that happens to correspond to the context of the single row table in FilterSegment, which is whatever transaction size the sales happen to fall into. It's black box, stupidly complicated nonsense and doesn't have to be nearly that difficult or obfuscated. MSHGQM - Don't Use CALCULATE! - YouTube
I do not understand why
CALCULATE
ALL
FILTER
is correct.
Why is the first CALCULATE?
'Transaction Size' is a table.
Anonymous Well, those are the correct answers according to if you Reveal Solution. I'm not saying any of it is correct. It's all trash DAX imho. But, according to the site, those are the "right" answers:
- Anonymous3 years agoNot applicable
Greg_Deckler The given "correct" answer cannot be correct. This is why I am asking here if MY answer which I suggest in the original post is correct.
- Greg_Deckler3 years ago
Community Champion
Anonymous The right answer is to dispose of all of that DAX and start over.
- Anonymous3 years agoNot applicable
Greg_Deckler In general, I would agree. But I am in the situation to have to pass the PL-300 Exam and as far as I understood, this has been an original question in an earlier version of that exam and I try to use these questions for preparation. Therefore, I am interested to understand which solution is correct (independent of the question if the code is best practice or not).