skip to main content
Power BI
    • What is Power BI
    • Why Power BI
    • Customer stories
    • Data visuals
    • Power BI Desktop
    • Power BI Pro
    • Power BI Premium
    • Power BI Mobile
    • Power BI Embedded
    • Power BI Report Server
  • Pricing
    • Azure + Power BI
    • Office 365 + Power BI
      • Energy
      • Healthcare
      • Manufacturing
      • Retail
    • For analysts
    • For IT
    • For developers
    • Overview
    • Find consulting services
    • Partner showcase
    • Find a partner
    • Become a partner
      • Overview
      • Guided learning
      • Documentation
      • Webinars
      • Roadmap
      • Overview
      • Issues
      • Give feedback
    • Blog
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Events
    • User groups
    • Community blog
    • Register
    • ·
    • Sign In
    • ·
    • Help
    Go To
    • Galleries
    • COVID-19 Data Stories Gallery
    • Themes Gallery
    • Data Stories Gallery
    • R Script Showcase
    • Webinars and Video Gallery
    • Quick Measures Gallery
    • MBAS Gallery
    • MBAS Gallery 2020
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power BI Community
    • Galleries
    • Data Stories Gallery
    • So You Think You Know DAX

    So You Think You Know DAX

    12-18-2017 02:50 AM - last edited 03-29-2018 20:53 PM

    Daniil
    Kudo Kingpin
    21688 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    Daniil
    Daniil Kudo Kingpin
    Kudo Kingpin
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    So You Think You Know DAX

    ‎12-18-2017 02:50 AM

    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

     

    eyJrIjoiMzc5OWMyMDYtNGE3MS00OWUzLTgzZjEtN2FlZDcyOGQyZTQwIiwidCI6ImQzMmNkYzNmLTY1NTUtNGNhYy1iYjFhLTg2OWZiMTE0MzRlNSJ9

    Preview file
    19 KB
    Labels:
    • Labels:
    • Bookmarking
    Message 1 of 18
    21,688 Views
    46
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    datadonuts
    datadonuts Helper I
    Helper I
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎09-29-2020 04:48 AM

    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 

     

     

     

     

     

     

     

    Community_DoYouKnowDAX.pbix
    Message 17 of 18
    1,724 Views
    0
    Reply
    Daniil
    Daniil Kudo Kingpin
    Kudo Kingpin
    In response to datadonuts
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎10-02-2020 08:55 PM

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

    Message 18 of 18
    1,667 Views
    1
    Reply
    WmRod
    WmRod
    Regular Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎03-04-2020 02:07 PM

    This is great - thanks!

    Message 16 of 18
    1,888 Views
    0
    Reply
    Anonymous
    Not applicable
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎07-15-2018 10:23 PM

    quiz.PNG

    Message 15 of 18
    2,284 Views
    0
    Reply
    Anonymous
    Not applicable
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎01-04-2018 10:44 AM

    Hi Daniil,

     

    Nice Dashboard!

     

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

    Message 13 of 18
    2,518 Views
    0
    Reply
    Daniil
    Daniil Kudo Kingpin
    Kudo Kingpin
    In response to Anonymous
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎01-08-2018 06:06 PM

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

    Message 14 of 18
    2,491 Views
    0
    Reply
    ngadiez
    ngadiez Helper II
    Helper II
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-29-2017 12:53 AM

    Hi @Daniil

     

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

    Capture.PNG

    Message 12 of 18
    2,548 Views
    0
    Reply
    Anonymous
    Not applicable
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-28-2017 07:58 AM

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

    Message 11 of 18
    2,563 Views
    0
    Reply
    hohlick
    hohlick
    MVP
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-22-2017 07:42 AM

    Excellent, Daniil!

    The best effect is on the last step!

     

    Kudos!

    Maxim

    Maxim Zelensky
    excel-inside.pro
    Message 9 of 18
    20,462 Views
    0
    Reply
    Daniil
    Daniil Kudo Kingpin
    Kudo Kingpin
    In response to hohlick
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-24-2017 03:17 PM

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

    Message 10 of 18
    20,360 Views
    0
    Reply
    MFelix
    Super User III MFelix
    Super User III
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-20-2017 07:53 AM

    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





    Message 8 of 18
    20,654 Views
    0
    Reply
    Rod
    Rod Advocate II
    Advocate II
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-18-2017 06:43 AM

    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.

    Message 5 of 18
    21,395 Views
    0
    Reply
    prateekraina
    prateekraina Memorable Member
    Memorable Member
    In response to Rod
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-18-2017 10:03 PM

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

    Message 6 of 18
    21,024 Views
    0
    Reply
    Rod
    Rod Advocate II
    Advocate II
    In response to prateekraina
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-19-2017 09:29 AM

    Oh I see, Thanks a lot for your input!

    Message 7 of 18
    20,823 Views
    0
    Reply
    Anonymous
    Not applicable
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-18-2017 04:27 AM

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

    Message 2 of 18
    21,513 Views
    1
    Reply
    Daniil
    Daniil Kudo Kingpin
    Kudo Kingpin
    In response to Anonymous
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-19-2017 05:04 AM

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

     

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

    Message 3 of 18
    20,908 Views
    0
    Reply
    Anonymous
    Not applicable
    In response to Daniil
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎12-19-2017 05:43 AM

    @Daniil, awesome, thanks. I've only started my journey with DAX and your 5 queries has helped me to undersand few things.  

    Message 4 of 18
    20,883 Views
    0
    Reply
    Preview Exit Preview

    never-displayed

    You must be signed in to add attachments

    never-displayed

    Additional options
    You do not have permission to remove this product association.
     

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Automate
    • Power Virtual Agents

    • Sign in
    • Sign up

    Browse

    • Solutions
    • Partners
    • Consulting Services

    Downloads

    • Power BI Desktop
    • Power BI Mobile
    • Power BI Report Server
    • See all downloads

    Learn

    • Guided learning
    • Documentation
    • Support
    • Community
    • Give feedback
    • Webinars
    • Developers
    • Blog
    • Newsletter

    • © 2021 Microsoft
    • Follow Power BI
    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks