Forum Discussion

BeardyGeorge's avatar
BeardyGeorge
Advocate I
10 years ago
Solved

Prevent Power BI Automatically Renaming Columns to Include Spaces

Hi All,   I'm trying to make use of the R scripting option to make some visualisations, but it's presenting some fairly serious issues. For starters, the fact Power BI replaces underscores in fiel...
  • BeardyGeorge's avatar
    BeardyGeorge
    10 years ago

    On closer inspection it appears the spaces are automatically inserted at some point during the OLAP/MDX level rather than by PowerBI itself, however that doesn't really help resolve the problem.

    Regardless of how the spaces are being inserted, I still need to get rid of them in R.

     

    EDIT:

    on testing it appears that the following solves the problem:

    names(dataset) <- gsub(" ","_",names(dataset))