Forum Discussion

Pinita06's avatar
Pinita06
New Member
2 years ago
Solved

New Data source additional columns not showing

Hi, I just changed my Data source for my POwer Bi Dashboard I have added some new columns. When I Change the source the new columns are not included in the data set. I tried to add them in the advance editor and got the "Expression.Error: We expected newColumnNames to have the same number of items as columnNames". I have tried to refresh the data, to add columns, but nothings seems to work. Help, please!

  • Pinita06 OK, this would have been easier with text. Expand Columns takes 4 parameters typically. There is the table, the column you want to expand in that table and then 2 lists. The first list is the name of the columns that you want to end up with and the second list is the column name that you want out of the expanded column. You need to have the same number of entries in both lists.

6 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Pinita06 Can you share the relevant before and after M code from Advanced Editor? Generally this happens when you added column names but not the actual columns in the expression or vice versa. You generally have to enter it twice into the expression (the name of the column).

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Pinita06 OK, this would have been easier with text. Expand Columns takes 4 parameters typically. There is the table, the column you want to expand in that table and then 2 lists. The first list is the name of the columns that you want to end up with and the second list is the column name that you want out of the expanded column. You need to have the same number of entries in both lists.

  • MNedix's avatar
    MNedix
    Solution Sage

    I had the same issue in the past and I solved it in a different way.

    In the affected Query -> Advanced Editor, in the "let" section look for the Columns descriptor. You can do one of 2 things:

    1. increase the number with the new(ly) added columns. Let's say you had 10 columns and you've added 2 more then you have to change the number to 12

    2. (what I did) I changed the number to null (no brackets, no nothing). This way, you don't have to do anything if you add new columns in the future.

     

    Hope it works for you.

    • Pinita06's avatar
      Pinita06
      New Member

      Hi, I looked for the #Columns and I can't find it...

      This is my Historical in the Advance editor:

      This is how I'm adding the columns.

       

      • MNedix's avatar
        MNedix
        Solution Sage

        What do you have in Source? My Query -> Advanced Editor looks like the snapshot and you can see  highlighted the number of columns. If I what to add more colomns to the source (Campaign.csv) then I'll have to change this number accordingly.