How to run such a DAX code

  • How to run such a DAX code

    Posted by DSC Communities on May 4, 2020 at 8:34 am
    • Robert Lauga

      Member

      May 4, 2020 at 8:34 AM

      Hello,
      I’m trying to study the SUMMARIZE function. So I found the example bellow, but I don’t know how to execute this code in Power BI or in Excel.
      Thanks to the experts who can help a beginner!

      EVALUATE

      SUMMARIZE (

      Ā Ā Ā  Sales,

      Ā Ā Ā  Sales[Color],

      Ā Ā Ā  “Sales”, SUM ( Sales[Amount] ),

      Ā Ā Ā  “AllColorSales”,

      Ā Ā Ā  CALCULATE (

      Ā Ā Ā Ā Ā Ā Ā  SUM ( Sales[Amount] ),Ā 

      Ā Ā Ā Ā Ā Ā Ā  ALL ( Sales[Color] )

      Ā Ā Ā Ā  ),

      Ā Ā Ā  “AllSales”,

      Ā Ā Ā  CALCULATE (

      Ā Ā Ā Ā Ā Ā Ā  SUM ( Sales[Amount] ),Ā 

      Ā Ā Ā Ā Ā Ā Ā  ALL ( Sales )

      Ā Ā Ā  )

      )

      ——————————
      Robert Lauga
      ——————————

    • Audrey Abbey

      Member

      May 4, 2020 at 10:35 AM

      In Power BI, you would create a measure.Ā 

      Give it a name, then an equals sign, then your code goes after the equal sign.Ā 
      Remove the Evaluate command from the beginning.Ā 
      That is only used if you are running this command from SSMS or similar program.

      Like this:

      Summarize Example =Ā 

      SUMMARIZE (

      Ā Ā Ā  Sales,

      Ā Ā Ā  Sales[Color],

      Ā Ā Ā  “Sales”, SUM ( Sales[Amount] ),

      Ā Ā Ā  “AllColorSales”,

      Ā Ā Ā  CALCULATE (

      Ā Ā Ā Ā Ā Ā Ā  SUM ( Sales[Amount] ),Ā 

      Ā Ā Ā Ā Ā Ā Ā  ALL ( Sales[Color] )

      Ā Ā Ā Ā  ),

      Ā Ā Ā  “AllSales”,

      Ā Ā Ā  CALCULATE (

      Ā Ā Ā Ā Ā Ā Ā  SUM ( Sales[Amount] ),Ā 

      Ā Ā Ā Ā Ā Ā Ā  ALL ( Sales )

      Ā Ā Ā  )

      )

      ——————————
      Audrey Abbey
      SR. BI Developer/Analyst
      LeapFrogBI
      Portland OR
      ——————————
      ——————————————-

    • Xavier Gobert

      Member

      May 5, 2020 at 2:59 AM

      Hi,

      The outcome of the SUMMARIZE DAX function is a table so the result should be mapped to a table.

      In Power BI, you create a new table by clicking on the button “New table” under the “Modeling” ribbon.
      Then you just need to copy/paste Your DAX expression:
      Table Name = Your DAX Expression

      You will be able to see the results in the newly created table.

      Enjoy

      Xavier

      ——————————
      Xavier Gobert
      Head of Internal Development and BI
      Tomra
      Leuven
      ——————————
      ——————————————-

    DSC Communities replied 5 years, 11 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘How to run such a DAX code’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!