Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How to adjust grouped items by another field

One of the primary columns in my data set is "location," but one of my locations needs to be broken out into three separate locations.  I have data in another column that I can use to do this (based ...
  • SteveHailey's avatar
    4 years ago

    I think you could create a new Custom Column in Power Query that looks something like below. Then remove your original location column. 

     

    if [Location] <> "USA" then [Location]
    else if [Department] = "Beach" then "Florida"
    else if [Department] = "Bourbon" then "Kentucky"
    else if [Department] = "Jazz" then "New Orleans"
    else [Location]

     

    In this example, "USA" is the one location that needs broken out. If the location is not USA, then it just returns the original location. If it is USA, then it checks the department column, and returns "Florida", "Kentucky", or "New Orleans", depending on the value in the department column.

     

    -Steve

  • Anonymous's avatar
    Anonymous
    4 years ago

    Thanks Steve!

     

    It appears that I now have two working options.  I also tried a conditional column that appears to be working for me given that the department values I am sorting on are unique to the new locations I want to create: