Delimited Data – Extracting Records Using LuckyTemplates

I’m going to show you how to extract records from merged delimited data within multiple columns. This turns your data into a format that’s more suitable for analysis.

There are a number of ways to do this. But for this tutorial, I’m going to focus on a solution suggested by Ankit, who’s part of our LuckyTemplates community. You may watch the full video of this tutorial at the bottom of this blog.

Table of Contents

Using Text.Split

For this solution, I’m going to use Power Query to extract records from delimited data.

Below is the Opportunities table within Power Query.

Delimited Data – Extracting Records Using LuckyTemplates

As you can see, there are multiple values concatenated into a single record. In the 2nd row, for example, there are 4 different values presented. These 4 values are merged together under the Competitors and Competitor Amounts columns.

Delimited Data – Extracting Records Using LuckyTemplates

The first thing I’m going to do is use Text.Split.

Delimited Data – Extracting Records Using LuckyTemplates

Text.Split returns a list after splitting a text value based on a specific delimiter.

To start using Text.Split, I’m going to copy the delimiter used in this table.

Delimited Data – Extracting Records Using LuckyTemplates

You’ll notice that once I click on that entry in the table, the record value shows up at the bottom. I’ll just copy the delimiter from there.

Delimited Data – Extracting Records Using LuckyTemplates

Once I’ve done that, I’m going to add a custom column.

Delimited Data – Extracting Records Using LuckyTemplates

I don’t have to change the name just yet. I just need to do a Text.Split under Custom Column Formula.

Delimited Data – Extracting Records Using LuckyTemplates

This formula needs a text value. So I’ll just choose the Competitors column on the right pane and it’s automatically added to the formula.

Delimited Data – Extracting Records Using LuckyTemplates

I also need a separator given as a text. So inside a pair of quotation marks, I’m going to paste the delimiter I copied earlier. Then, I’ll add the closing parenthesis.

Delimited Data – Extracting Records Using LuckyTemplates

Once I press OK, I’ll end up with a list object.

Delimited Data – Extracting Records Using LuckyTemplates

Looking at the first list, the Competitors and Amounts columns both show only one entry. So if I click on the empty space beside the list object under the Custom column, it also shows a single value at the bottom.

Delimited Data – Extracting Records Using LuckyTemplates

For the second record, I have a list that contains four values. This corresponds to the 4 values also shown in the Competitors column and Amounts column.

Delimited Data – Extracting Records Using LuckyTemplates

Using List.Zip

Now that I’ve split the list, the next step is to add the corresponding value from the Competitor Amounts column. I’m going to the List.Zip to do that.

Delimited Data – Extracting Records Using LuckyTemplates

Think of List.Zip as an actual zipper. It takes a list of lists and combines the items.

Looking at the example below, just think of the first list (1 and 2) as the green track on the zipper.

Delimited Data – Extracting Records Using LuckyTemplates

Then, think of 3 and 4 as the red track.

Delimited Data – Extracting Records Using LuckyTemplates

When List.Zip is applied, they come together in the middle. So 1 from the 1st group is combined with 3 from the 2nd group. The same thing happens for 2 and 4. This can be seen on the output, where there are two new groups that have been formed.

Delimited Data – Extracting Records Using LuckyTemplates

There may be times when the lists involved have different lengths. This means that if the lists are combined, the missing data will be returned. To create exact pairs despite the lack of data, a null value is added.

Delimited Data – Extracting Records Using LuckyTemplates

Going back to the Opportunities table, I’m going to add another custom column.

Delimited Data – Extracting Records Using LuckyTemplates

This time, I’m going to add the Competitor Amounts column to the formula.

Delimited Data – Extracting Records Using LuckyTemplates

I’m also going to add List.Zip.

Delimited Data – Extracting Records Using LuckyTemplates

Checking below, it shows that there are no errors detected.

Delimited Data – Extracting Records Using LuckyTemplates

But when I click OK and look at the new column formed, I still end up getting an error.

Delimited Data – Extracting Records Using LuckyTemplates

I’m going to click on the white space beside the error to see the details. It shows that I’m getting an error because I returned some arguments around the lists.

Delimited Data – Extracting Records Using LuckyTemplates

Looking at the formula, it shows that this syntax where the Competitors column was referenced returned a list.

Delimited Data – Extracting Records Using LuckyTemplates

But the syntax for the Competitor Amounts columns also returned a list.

Delimited Data – Extracting Records Using LuckyTemplates

Recalling what List.Zip does, it takes a single list of lists and combines them.

Delimited Data – Extracting Records Using LuckyTemplates

Seeing that there are two lists showing up, I need the list initializer to bring those lists together. That’s why I’m adding these curly brackets.

Delimited Data – Extracting Records Using LuckyTemplates

Once I add the closing curly bracket at the end, I just need to press enter. That will give me a list object.

Delimited Data – Extracting Records Using LuckyTemplates

Now, when I click off to the side of the 1st record, it shows a single list object. This is correct, seeing that under Competitor Amounts, there really is a single value there.

Delimited Data – Extracting Records Using LuckyTemplates

If I do the same thing to the second record, it shows a list object containing 4 lists. That also matches the number of values in the delimited data under Competitor Amounts.

Delimited Data – Extracting Records Using LuckyTemplates

I’ll use the sideward arrows to the right of the heading of the Custom column to expand the data into new rows.

Delimited Data – Extracting Records Using LuckyTemplates

Pay attention to the second record as I expand to new rows.

Delimited Data – Extracting Records Using LuckyTemplates

You’ll see that all the values from that record get expanded down.

Delimited Data – Extracting Records Using LuckyTemplates

And when I click off to the side in the white space, I can see the content of that nested list. Since the 1st record has only one value for each column, I’m also showing the same data at the bottom.

Delimited Data – Extracting Records Using LuckyTemplates

But when I click on the 2nd record, you’ll see that I’m only showing the 1st of the 4 values given in my delimited data.

Delimited Data – Extracting Records Using LuckyTemplates

On the third record, I show the combination of the second values.

Delimited Data – Extracting Records Using LuckyTemplates

So I’m going to use the sideward arrows again. But this time, I’m going to extract the values from that list.

Delimited Data – Extracting Records Using LuckyTemplates

I’m going to give it a custom separator.

Delimited Data – Extracting Records Using LuckyTemplates

I’ll use the double pipe as my delimiter. This should make the distinction among the values in the delimited data clearer.

Delimited Data – Extracting Records Using LuckyTemplates

Once I press OK, the values are concatenated right into the Custom column.

Delimited Data – Extracting Records Using LuckyTemplates

Cleaning Up The Data

I no longer need the Competitor and the Competitor Amounts columns, so I’m going to remove those columns.

Delimited Data – Extracting Records Using LuckyTemplates

As for the Custom column, I’m going to split that.

On the transform tab, I’m going to select Split Column. I’m going to split it by the delimiter.

Delimited Data – Extracting Records Using LuckyTemplates

In the window, I’m going to give the double pipe as basis.

Delimited Data – Extracting Records Using LuckyTemplates

Once I press OK, the data will now be split into separate columns.

Delimited Data – Extracting Records Using LuckyTemplates

I’ll just rename these new columns to make it easier to figure out what the data is about. I’ll call this the Competitor column again.

Delimited Data – Extracting Records Using LuckyTemplates

Then I’ll call the other column the Amount column.

Delimited Data – Extracting Records Using LuckyTemplates

Obviously, the Amount column contains numbers. But if you look at the icon representing the data type, it shows that I have text instead of numbers. So I’ll start fixing that.

I’m based in Europe, so we use a period as a thousands separator instead of a comma. I’m going to use Replace Values to clean that up.

Delimited Data – Extracting Records Using LuckyTemplates

In the window, I just need to put a comma under Value To Find, and a period under Replace With.

Delimited Data – Extracting Records Using LuckyTemplates

Once I press OK, all the commas will now show periods instead.

Delimited Data – Extracting Records Using LuckyTemplates

The next thing I’m going to do is remove the dollar sign in front of the values. Again, I’ll use the Replace Values tool. This time, I’ll leave the space for Replace With with a blank.

Delimited Data – Extracting Records Using LuckyTemplates

Once I press OK, the values will only show the numbers without any currency.

Looking down my column, it also shows an entry here with a double dash. Since that could return a possible error, I’m going to get rid of that double dash.

Delimited Data – Extracting Records Using LuckyTemplates

I’ll replace the double dash with a blank.

Delimited Data – Extracting Records Using LuckyTemplates

And once I press OK, I have the right format for all the entries under the Amount column.

Delimited Data – Extracting Records Using LuckyTemplates

I can now click on the icon for the data type and choose Whole Number.

Delimited Data – Extracting Records Using LuckyTemplates


Change Date Formats Using The Power Query Editor
3 Ways To Combine Values Using DAX Inside LuckyTemplates
Advanced Transformations in LuckyTemplates

Conclusion

As I mentioned earlier, you can extract values from delimited data in different ways. But for me, this approach is one of the easiest and fastest ways to do it.

Since I got the idea for this solution from one of the members of the community, this also shows how important the is. You can really see each problem from many different perspectives. From there, you can just choose a solution that you think would work best for you.

All the best,

Melissa

***** Learning LuckyTemplates? *****






Leave a Comment

Excel Hücrelerini Metne Sığdırma: 4 Kolay Çözüm

Excel Hücrelerini Metne Sığdırma: 4 Kolay Çözüm

Excel hücrelerini metne sığdırmak için güncel bilgileri ve 4 kolay çözümü keşfedin.

Bir Excel Dosyasının Boyutu Nasıl Küçültülür – 6 Etkili Yöntem

Bir Excel Dosyasının Boyutu Nasıl Küçültülür – 6 Etkili Yöntem

Bir Excel Dosyasının Boyutunu Küçültmek için 6 Etkili Yöntem. Hızlı ve kolay yöntemler ile verilerinizi kaybetmeden yer açın.

Pythonda Self Nedir: Gerçek Dünyadan Örnekler

Pythonda Self Nedir: Gerçek Dünyadan Örnekler

Python'da Self Nedir: Gerçek Dünyadan Örnekler

Rde Bir RDS Dosyası Nasıl Kaydedilir ve Yüklenir

Rde Bir RDS Dosyası Nasıl Kaydedilir ve Yüklenir

R'de bir .rds dosyasındaki nesneleri nasıl kaydedeceğinizi ve yükleyeceğinizi öğreneceksiniz. Bu blog aynı zamanda R'den LuckyTemplates'a nesnelerin nasıl içe aktarılacağını da ele alacaktır.

İlk N İş Günü Tekrar Ziyaret Edildi – Bir DAX Kodlama Dili Çözümü

İlk N İş Günü Tekrar Ziyaret Edildi – Bir DAX Kodlama Dili Çözümü

Bu DAX kodlama dili eğitiminde, GENERATE işlevinin nasıl kullanılacağını ve bir ölçü başlığının dinamik olarak nasıl değiştirileceğini öğrenin.

LuckyTemplatesda Çok İş Parçacıklı Dinamik Görsel Tekniği Kullanarak Öngörüleri Sergileyin

LuckyTemplatesda Çok İş Parçacıklı Dinamik Görsel Tekniği Kullanarak Öngörüleri Sergileyin

Bu eğitici, raporlarınızdaki dinamik veri görselleştirmelerinden içgörüler oluşturmak için Çok Kanallı Dinamik Görseller tekniğinin nasıl kullanılacağını kapsayacaktır.

LuckyTemplatesda İçeriği Filtrelemeye Giriş

LuckyTemplatesda İçeriği Filtrelemeye Giriş

Bu yazıda, filtre bağlamından geçeceğim. Filtre bağlamı, herhangi bir LuckyTemplates kullanıcısının başlangıçta öğrenmesi gereken en önemli konulardan biridir.

LuckyTemplates Çevrimiçi Hizmetindeki Uygulamaları Kullanmak İçin En İyi İpuçları

LuckyTemplates Çevrimiçi Hizmetindeki Uygulamaları Kullanmak İçin En İyi İpuçları

LuckyTemplates Apps çevrimiçi hizmetinin çeşitli kaynaklardan oluşturulan farklı raporların ve içgörülerin yönetilmesine nasıl yardımcı olabileceğini göstermek istiyorum.

Fazla Mesai Kâr Marjı Değişikliklerini Analiz Edin - LuckyTemplates ve DAX ile Analitik

Fazla Mesai Kâr Marjı Değişikliklerini Analiz Edin - LuckyTemplates ve DAX ile Analitik

LuckyTemplates'da ölçü dallandırma ve DAX formüllerini birleştirme gibi teknikleri kullanarak kâr marjı değişikliklerinizi nasıl hesaplayacağınızı öğrenin.

DAX Studioda Veri Önbellekleri İçin Materyalleştirme Fikirleri

DAX Studioda Veri Önbellekleri İçin Materyalleştirme Fikirleri

Bu öğreticide, veri önbelleklerini gerçekleştirme fikirleri ve bunların DAX'ın sonuç sağlama performansını nasıl etkilediği tartışılacaktır.