10-02-2020 20:55 PM
came across your report. Besides you just schattered my confidence that I was on a good way to understand a bit of DAX, the quiz is great. I understand that you intentionally built the example, but it can happen in the real world as well -> https://sqlkover.com/sumx-returns-incorrect-results-with-duplicates/
Unfortunately I do not understand all your explanations (yet) and Alberto's posts made my head even more spinning. I am very confused, as a beginner we use COUNTROWS and SUMX a lot and we are proud of ourselves, that we finally get some nice visuals out of it. Now it seems we cannot trust even the simplest calculation without doublechecking the results in Excel (which brings us back to 1987). Then what's the point of having DAX, if SUMX returns 7 (question 3) in a data set of 1,3,1 (which ... for me ... totals still 5, unless the earth spinns the other way around); I tripplechecked on my old fashion calculator and it says 1+3+1=5, I intend to believe that.
Ok, stop whining ... here are my questions:
For comparison reasons and following the tip from Koen, I built your example with an index column, which solved most, but not all problems (-> VAR).
I learned, that the "DAX onion" is eaten from the inside out, meaning complex DAX is executed from inside to outside.
From that understanding the result should be blank.
First the "inside" CALCULATE returns a distinct list of values (colors) which is then filtered down to only "Black".
Then the "outside" CALCULATE shall return "White". But as there is no "White" after step 1, it shall return Blank.
What's wrong with that (my) thinking?
I read a lot about strange behavior of VAR and wrong results. VAR is a wonderful tool to structure DAX code, but how can I make sure, that the result does not come out rubbish?
Many thanks in advance
@datadonuts, thanks for the comment! DAX does require the understanding of theory indeed 🙂
On Q2: Context is considered from the outside to inside. On the outside, we've got White. Then inside, we've got Black, which overrides White, because column filters have ALL in them. I.e. White is ignored, then Black is set.
On Q4 (you probably meant Q4 not Q5 because Q5 has no VAR): this question was leveraging the fact that variables can't be re-evaluated under a different context. They're evaluated only once, then they become constants. Hence no matter what filters you apply to a variable that's been evaluated already, the results won't change -- just like if you tried CALCULATE(5, ...
@Anonymous, thank you! There is only one page, so the bar is not visible. I don't think you can hide the bar when there is more than one page.
@ngadiez, there is a set of hidden slicers to keep track of scores. I'm writing a blog post that explains this technique in more detail.
@hohlick, thank you, Maxim 🙂
@MFelix, are you referring to "How well do you know the Simpsons"? I think they used a custom visual to achieve the effect of "saving" answers. In my report, I am not using any custom visuals -- only the built-in features of Power BI Desktop. I used the latest enhancements to the bookmarking feature, which allow you to modify only selected visuals and not the entire page. I might write a blog post on it to explain better 🙂
Great dashboard !
Just one question that I have already seen in another dashboard but was not abble to get it.
How do you achieve to "save" the answers in order to have the final graph?