Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Split columns based on multiple suffix values

I want to split column based on suffix values in Powery query and need to create 2 custom column

 

For example,  Column needs to be split and custom columns Main and Key needs to be created based on suffix values 1,25,12 

 

blokesh23_0-1643997098519.png

 

1 ACCEPTED SOLUTION

Hi, @Anonymous 

 

You can create two columns like this:

Key = SWITCH(true(),RIGHT([Column],1)="1",1,RIGHT([Column],2)="25",25,RIGHT([Column],2)="12",12)
Main = SWITCH(true(),[Key]=1,([Column]-1)/10,[Key]=25,([Column]-25)/100,[Key]=12,([Column]-12)/100)

vjaneygmsft_0-1644402702154.png

Best Regards,

Community Support Team _Janey

If this post helps, then please consider Accept it as the solution to help the other members find it more.

 

View solution in original post

4 REPLIES 4
goncalogeraldes
Super User
Super User

Hello there @Anonymous ! What is your criteria for splitting? Is there any kind of pattern?

Anonymous
Not applicable

Hi @goncalogeraldes , yes based on the key values which are added at last . In the above example for value 567891 , 1 is key similarly for value 7896525 , 25 is the key . As of now we can consider 1, 25 and 12 as key values  for entire data set

Hi, @Anonymous 

 

You can create two columns like this:

Key = SWITCH(true(),RIGHT([Column],1)="1",1,RIGHT([Column],2)="25",25,RIGHT([Column],2)="12",12)
Main = SWITCH(true(),[Key]=1,([Column]-1)/10,[Key]=25,([Column]-25)/100,[Key]=12,([Column]-12)/100)

vjaneygmsft_0-1644402702154.png

Best Regards,

Community Support Team _Janey

If this post helps, then please consider Accept it as the solution to help the other members find it more.

 

Anonymous
Not applicable

Thanks for you reposne , this works

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.