Re: So You Think You Know DAX

Kudo Kingpin
25122 Views
Daniil
Kudo Kingpin
Kudo Kingpin

So You Think You Know DAX

This is a five-question quiz on DAX.

 

Can you answer all five questions correctly? 🙂

 

Enjoy!

 

Daniil Maslyuk

https://xxlbi.com/

https://twitter.com/DMaslyuk

 

TrevorC
Advocate I
Advocate I

Excellent use of Power BI to confirm my suspicion that I need to work on my DAX skills. The one on variables was VERY interesting and I totally got it right. Totally.

iacentre
Frequent Visitor

Hi, It is a great app. Could you share your pbix file to me (iacentre@gmail.com)? Thanks

ippi000
Advocate I
Advocate I

I really liked this dashboard, I haven't met any tests in power bi yet

ippi000_0-1656946770750.png

 

datadonuts
Advocate II
Advocate II

Hi Daniil,

 

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).

 

Question 2 color filter

 

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?

 

Question 5 VAR

 

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 

 

 

 

 

 

 

 

This is a witty power BI report and it lost my confidence in DAX 😥

mussaenda_0-1692699769246.png

 

@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, ...

avatar user
Anonymous
Not applicable

This is great - thanks!

avatar user
Anonymous
Not applicable

quiz.PNG

avatar user
Anonymous
Not applicable

Hi Daniil,

 

Nice Dashboard!

 

How Do you hide the bar that is underneath that shows the page number?

@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.

ngadiez
Helper II
Helper II

Hi @Daniil

 

May I know how did you calculate number of correct or wrong like this? How to keep track?

Capture.PNG

avatar user
Anonymous
Not applicable

I know it's a dumb question, but how do you hide that bar underneath that shows the number and name of the pages?

hohlick
Continued Contributor
Continued Contributor

Excellent, Daniil!

The best effect is on the last step!

 

Kudos!

Maxim

Maxim Zelensky
excel-inside.pro

@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 🙂

MFelix
Super User
Super User

Hi @Daniil,

 

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? 

 

Thank you.

 

Regards,


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Rod
Advocate II
Advocate II

This is probably basic but as a newbie I must ask how do you create buttons that allows you to navigate through pages.

 

In this case, th answer button.

That is achieved by bookmarks. So you basically create an image as a button by linking it to a preset bookmark.

Oh I see, Thanks a lot for your input!

avatar user
Anonymous
Not applicable

This is brilliant. Having the DAX formulae on the answer page would have been helpful! 

@Anonymous, thanks for your feedback! DAX formulas should now be visible in answers 🙂

 

@Rod@prateekraina gave the correct answer to your question 🙂

avatar user