Forum Discussion

prvn's avatar
prvn
Frequent Visitor
4 years ago
Solved

Relationship for Comma seperated id column

I have 2 tables as shown below, master table has unique keys and used in other tables. 

GroupQuestions table has a column ActivityIds, which are array of master key, i have transformed it into comma seperated and data looks like below

After setting the relationship for Masterkey to Grouped Questions as 1:* the report grid does not seem to work when i filter with slicer. The comma seperated ids are not joined.

How do i solve this?

  • prvn's avatar
    prvn
    4 years ago

    I did not want to split into rows as i wanted to view the cell value with comma seperated items. But this made me think and i went with splitting the arrays to rows and then did a custom measure later where i concatenated everything back.
    This link helped me Solved: group by and then concateate comma separated - Microsoft Power BI Community

    The custom measure is like below

    Combined Ast = 
    VAR __rlvnttable =
        CALCULATETABLE (
            VALUES ( 'ToGroupAnwsers'[Document.Questions] ),
            'ToGroupAnwsers'[Document.Questions] <> BLANK ()
        )
    RETURN
        CONCATENATEX (
            __rlvnttable,
            'ToGroupAnwsers'[Document.Questions],
            ", ",
            'ToGroupAnwsers'[Document.Questions], ASC
        )

     

    Will keep in mind to post data in next post 🙂

3 Replies

  • Split that column into rows, not additional columns.  

     

    Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. Avoid posting screenshots of your source data if possible.

    Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

    https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

    • prvn's avatar
      prvn
      Frequent Visitor

      I did not want to split into rows as i wanted to view the cell value with comma seperated items. But this made me think and i went with splitting the arrays to rows and then did a custom measure later where i concatenated everything back.
      This link helped me Solved: group by and then concateate comma separated - Microsoft Power BI Community

      The custom measure is like below

      Combined Ast = 
      VAR __rlvnttable =
          CALCULATETABLE (
              VALUES ( 'ToGroupAnwsers'[Document.Questions] ),
              'ToGroupAnwsers'[Document.Questions] <> BLANK ()
          )
      RETURN
          CONCATENATEX (
              __rlvnttable,
              'ToGroupAnwsers'[Document.Questions],
              ", ",
              'ToGroupAnwsers'[Document.Questions], ASC
          )

       

      Will keep in mind to post data in next post 🙂

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Icon for Community Support rankCommunity Support

    Hi prvn ,

     

    Thanks for your feedaback, this will give more people inspiration and help.😊

     

    If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


    Best Regards,
    Henry