Forum Discussion

shavish's avatar
shavish
Helper I
1 year ago
Solved

Solution for Power BI direct query for Merging columns.

I want to display my table like following (Data is an Example):

 

 

Where the Employer and Category need to be shown as merged coloumn. But in actual database every Name,ID and Address has Employer and Category and my requirement is to show them as one value instead of same value for each entry. Actual table from Database would look like for example:

 



The table will be retrieved from SQL server through the DIRECT QUERY. The parameters to select options will be passed as Dynamic parameter, so when a New employer gets selected the respective values corresponding from database will be shown on Power BI. If anyone can offer a solution for my problem it would be helpful. 

  • shavish Hey,
    I will recommend write something like below 

     

    SELECT
    CONCAT(Employer, ' - ', Category) AS Employer_Category,
    Name,
    ID,
    Address
    FROM
    your_table
    ORDER BY
    Employer, Category;

     

    then you update this here in Power query

     

     

    Thanks
    Harish M
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

7 Replies

  • Create a view in your SQL Server database and connect to that view instead.

    • shavish's avatar
      shavish
      Helper I

      Can you clarify in detail about your solution? I couldn't understand it yet. 

      • lbendlin's avatar
        lbendlin
        Super User

        Do your required merge/join at the data source, in SQL server.

  • shavish Hey,
    I will recommend write something like below 

     

    SELECT
    CONCAT(Employer, ' - ', Category) AS Employer_Category,
    Name,
    ID,
    Address
    FROM
    your_table
    ORDER BY
    Employer, Category;

     

    then you update this here in Power query

     

     

    Thanks
    Harish M
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi shavish ,
    Just wanted to check if you had the opportunity to review the suggestion provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi @shavish ,
    Just wanted to check if you had the opportunity to review the suggestion provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Just wanted to check if you had the opportunity to review the suggestion provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You