Forum Discussion

simona0808's avatar
simona0808
Helper I
3 years ago

Dax trim function

Hello everyone,

I am working on a project and I would like to ask for some help.

As you can see in the image the left column(injured body parts) is coming from a checklist and is stored in a list separated by ;#. Is there a chance to trim that and add every injured body part related to the id column separately? I just need it on separate lines so I can make a relationship with another table that stores the single body parts

 

8 Replies

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    I am not 100% I follow but I assume you want to separate the list using ;# as delimiter and have the results show on different rows?

    If you have access to powerquery I recommend doign this there like this:

    Right-click and select "split column by delimiter" -> Select custom and enter ;#

    Select created column and unpivot:



    In dax you can do with e.g. using substitute function and some tricks. Here is an example blog of this by entreprisedna: Power BI Split Column By Delimiters In DAX (enterprisedna.co)

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/


    • simona0808's avatar
      simona0808
      Helper I

      Thank you very much for your answer! Thats what I want. I tried your approach but it says that it cant be applied in direct query mode. 

      • ValtteriN's avatar
        ValtteriN
        Community Champion

        In Directquery mode I am pretty sure this won't work and you will have to use dax option. If possible try changing your conenction to import/composite model then the original soltuion I provide should work.