Forum Discussion

CoreyLearnsBI's avatar
CoreyLearnsBI
Frequent Visitor
3 years ago

Adding More Than One Custom Column

How do I get my query to show all 4 custom columns I've created? It's only showing 1 of the 4 custom columns, despite having 4 separate steps to add 4 custom columns.

 

Here is an example of 1 of the DAX statements I've written to add leading zeroes.

= Table.AddColumn(#"Changed Type", "Grouper ID (With Zeroes)", each Text.PadStart(Text.From([GRPR_ID] ),8,"0"))

7 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    CoreyLearnsBI That sounds really odd. Are you sure you have clicked on the last step of the Applied Steps pane over on the right?

    • CoreyLearnsBI's avatar
      CoreyLearnsBI
      Frequent Visitor

      I am hovering over the last step in the "Applied Steps" pane. Is there a limit for the number of columns you can have in a dataset? This is a very large CSV file with 24 fields before adding the additional 4 customized columns.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Pretty certain that should not be the issue. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Did you make sure to alter the first argument in your Table.AddColumn argument?
    If you copy&pasted it, you might have not done that.

    More specifically, if the first argument is #"Changed Type" for every step, PowerBI will only be able to perform the first step. For any subsequent step, PowerBI will look for a table called Changed Type to manipulate, but your first step changed the table name to whatever name you put in front of the equation sign.

  • That is not a DAX statement, that is M-Code.

    What is the code for the other columns?

  • Chewdata's avatar
    Chewdata
    Icon for Responsive Resident rankResponsive Resident

    Can you post the entire M-code for the query?

    Go to advanced editor and copy.

    • Chewdata's avatar
      Chewdata
      Icon for Responsive Resident rankResponsive Resident

      Like Anonymous says, you should reference the previous step in your code. The code should look something like this:

      let
          Source = YOURSOURCE,
          #"Changed Type" = Table.TransformColumnTypes(Source,{{"Input", Int64.Type}}),
          add_Custom1 = Table.AddColumn(#"Changed Type", "Custom1", each [Input] + 1),
          add_Custom2 = Table.AddColumn(add_Custom1, "Custom2", each [Input] + 2),
          add_Custom3 = Table.AddColumn(add_Custom2, "Custom3", each [Input] + 3),
          add_Custom4 = Table.AddColumn(add_Custom3, "Custom4", each [Input] + 4)
      in
          add_Custom4

       all steps are referencing the previous step. Finaly the last step is referenced in the 'in' part of the code, so all steps are evaluated and loaded.