ADDCOLUMNS

  • ADDCOLUMNS

    Posted by DSC Communities on April 17, 2020 at 12:58 pm
    • GĆ©rard Ducouret

      Member

      April 17, 2020 at 12:58 PM

      Hello,

      I ‘m trying to run this DAX formula that I found in a book. It’s supposed to create a table with 3 columns. But I always get the error:.
      “The expression refers to multiple columns… cannot be converted to a scalar value”


      What I’m missing ?
      Thanks for your help
      Here is the code:

      Colors =
      ADDCOLUMNS (
      VALUES ( ‘Product'[Color] ) ;
      “Products”; CALCULATE ( COUNTROWS ( ‘Product’ ) );
      “Sales Amount”; [Sales Amount]
      )

      ——————————
      GƩrard Ducouret
      ——————————

    • Ashley Hsia

      Member

      April 17, 2020 at 6:30 PM

      That error ?occurs when your results are more than what is expected (i.e. PBI expected a single value and your feeding it a whole column).Ā Ā  This explains it somewhat:https://www.sqlgene.com/2019/04/30/dax-error-the-expression-refers-to-multiple-columns-multiple-columns-cannot-be-converted-to-a-scalar-value/

      In not knowing much about the underlying data/setup, I would suggest beginning to trouble-shoot by making sure you are starting out using the expected format/delivery/result (sorry, I don’t know the technical term here).Ā  What I mean is–are you using “New column” when you should be using “New table”?

      Hope that helps,

      ——————————
      AHsia
      ——————————
      ——————————————-

    • GĆ©rard Ducouret

      Member

      April 18, 2020 at 6:22 AM

      Thanks a lot Ashley!Ā You pined the issue!
      Now that works

      ——————————
      GƩrard Ducouret
      ——————————
      ——————————————-

    • Cekou C.

      Member

      April 18, 2020 at 1:37 AM

      Hi GƩrard,

      I just tried your formula and it works fine. Maybe you can check your data model and relationships.

      ——————————
      Cekou C.
      Accounting Supervisor & PBI Enthusiast
      ——————————
      ——————————————-

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

Sorry, there were no replies found.

The discussion ‘ADDCOLUMNS’ 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!