Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi all,
I have a problem with data formatting I am not able to resolve myself. I hope someone can give me a good hint on how to solve it.
I have a table with item numbers, description etc. The item numbers have unfortunately various formats (this is due to the bad data governance in our company). Some item numbers have 4,5 or 6 digits (e.g. 9718 or 78644). We also have special item numbers, e.g. 78644-0001 and M78644)
I have the article category group in a separate table and I would like to match them together with a relationship. The thing is, that I only have the category available for the first 5 digits, means 78644-0001 is not recognized and therefore no category is assigned to it.
I would like to format the item numbers in a way, that all the items with a -000X end are interpreted as 78644 only.
Is there a way to do it? I have come close to it by creating a separate column with only the first 5 digits, but items like M78644 are then not recognized.
Anyone an idea how to solve it?
Solved! Go to Solution.
Hi @kracrde,
You can model your data using the Query editor. As you have different cases in the data, some are having a delimiter '-' and some are starting with an alphabet. You need to apply the cleanup to all cases. Please see the video below that I created for you.
If this helped you, please mark this post as an accepted solution and like to give KUDOS .
Regards,
Affan
Hi @kracrde,
You can model your data using the Query editor. As you have different cases in the data, some are having a delimiter '-' and some are starting with an alphabet. You need to apply the cleanup to all cases. Please see the video below that I created for you.
If this helped you, please mark this post as an accepted solution and like to give KUDOS .
Regards,
Affan
 
					
				
		
Hi,
Can you try this formula for your calculated column?
Item =
IF (
    LEFT ( RIGHT ( Table1[ItemNumbers], 4 ), 3 ) = "000",
    LEFT ( Table1[ItemNumbers], 5 ),
    Table1[ItemNumbers]
)
Sample Output
| Original Item Numer | Item | 
| M78644 | M78644 | 
| 78644-001 | 78644 | 
| 78644 | 78644 | 
| 78644-005 | 78644 | 
This formula is only to test the logic as I have assumed that minimum there will be 5 characters. If you have items with length less than 5 characters, error will happen. You have to use IFERROR function to handle that error.
hi sreenathv
thank you for your quick reply. your formula has brought me a step further.
The numbers are correctly formatted except all which have an ending -0010 and higher.
All endings between -0001 and -0009 are fine.
e.g. 78644-0001 to 78644-0009 are ok
78644-0010 to 78644-9999 still show the -ending.
@kracrde Please try this in "Power Query Editor" by adding a "Custom Column"
if Value.Is(Value.FromText(Text.End([Value],4)),type number) and Text.Start(Text.End([Value],5),1) = "-" then "78644" else [Value]
 
Proud to be a PBI Community Champion
@kracrde If you want to do it in Power Query, please try "Custom Column" as below
if Text.Start(Text.End([Value],5),4) = "-000" then "78644" else [Value]
Proud to be a PBI Community Champion
 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
 
            | User | Count | 
|---|---|
| 84 | |
| 49 | |
| 36 | |
| 31 | |
| 30 |