Query Editor In LuckyTemplates | An Overview

In this tutorial, we’ll show a detailed example of why we always need to use the Query Editor in LuckyTemplates and what we can achieve when using it. 

It’s deemed a best practice to always bring your data into the Query Editor first.

We’ll show and prove it by running through some examples and issues that we might run into, and the way that data would look like if we don’t use the Query Editor.

Table of Contents

Why You Always Need To Use The Query Editor In LuckyTemplates

We can now import that data into our data model by clicking the Get data option. This option makes it easy to import files on our data model. However, we don’t really suggest doing this because we should always clean up and optimize our data on the Query Editor first.

Query Editor In LuckyTemplates | An Overview

Just to show an example on why it’s not a good idea to bring in our data directly to our data model, let’s import a sample file by clicking on the Get data and click the Excel workbook.

Query Editor In LuckyTemplates | An Overview

For this example, we’ll use this sample excel data file about Manufacturing Operations. Double click the file to bring it into our data model. 

Query Editor In LuckyTemplates | An Overview

Inside the Navigator, we’ll select this Operation_Data table and click the Load button. 

Query Editor In LuckyTemplates | An Overview

Then, It’ll immediately commit our table to our data model. This is where we might encounter a few problems. This is because committing a data file that’s not optimized yet could have some errors that we weren’t able to adjust or fix before reaching our data model.

Query Editor In LuckyTemplates | An Overview

We can just close it by clicking the Close button.

Query Editor In LuckyTemplates | An Overview

After that, it’ll continue to commit this unoptimized data with errors on our data model.

Query Editor In LuckyTemplates | An Overview

By looking at this data on our data table, we can see how massive this table is. This is not how we want our data to be inside our LuckyTemplates. There’s also probably a lot of redundant columns, or information that we don’t need inside this table that should be deleted first. What we want is to have optimized and clean tables to be able to build a model around our data. 

Query Editor In LuckyTemplates | An Overview

This is just some of the many reasons why we should always bring our data to the Query Editor first. 

Data Transformation Using Query Editor In LuckyTemplates

This other sample spreadsheet looks messy from a LuckyTemplates perspective. If we look at this one, there’s nothing good that we can do in LuckyTemplates with all these mini tables, redundant titles, and some irrelevant information. So, what we need to do first is to bring this into the Query Editor. Then, try to optimize and clean it up. 

Query Editor In LuckyTemplates | An Overview

I’ll show you how we can clean this spreadsheet or worksheet effectively by layering transformations on top of each other. Again, don’t just bring the data directly to our LuckyTemplates. Always transform or clean up your data on the Query Editor first. 

To open the Query Editor, just click the Transform data option.

Query Editor In LuckyTemplates | An Overview

Inside the Query Editor, import the file by clicking New Source. Then, choose the type of the file that you’d like to query. For this example, we’ll click the Excel Workbook because we want to query a spreadsheet or worksheet file.

Query Editor In LuckyTemplates | An Overview

After that, choose the file that you want to query. In this example, we’ll query the iPhone6 excel file.

Query Editor In LuckyTemplates | An Overview

We need to clean the entire worksheet so we’ll select the Sheet1 and click the OK button.

Query Editor In LuckyTemplates | An Overview

Then, we’ll see all these redundant columns, information, and null values that we need to clean up. This is a great example for showing what we can achieve inside the Query Editor. In the next steps, we’ll clean and optimize this table.

Query Editor In LuckyTemplates | An Overview

Let’s first rename our table. Under the Properties, rename this table to Sales Data.

Query Editor In LuckyTemplates | An Overview

Then, we can start cleaning up this spreadsheet in a number of different ways and orders. For this tutorial, we’ll start off by removing the null values.

1. Removing The Null Values

We can easily remove the null values by clicking the arrow down icon of the columns with null values. 

Query Editor In LuckyTemplates | An Overview

Then, uncheck the (null) under the Filters option, and click the OK button.

Query Editor In LuckyTemplates | An Overview

Now, we’ll see that the null values are gone. 

Query Editor In LuckyTemplates | An Overview

2. Removing The Redundant Information

The next thing we can do is to remove the redundant information within these rows of our table. We currently have the ItemNumber, ProductName, ClassificationGroup, and some range of dates. We’ll remove these repetitions and bring the first row up to the header instead.

Query Editor In LuckyTemplates | An Overview

To do that, click the Transform tab. Then, select the Use First Row as Headers.

Query Editor In LuckyTemplates | An Overview

As a result, those items became our actual headers which is what they should actually be.

Query Editor In LuckyTemplates | An Overview

After that, we can now remove the same items on our rows by unchecking them on our Filters. For the ItemNumber column, we can uncheck the ItemNumber option on its filters.

Query Editor In LuckyTemplates | An Overview

What’s good about this is it automatically hides all those particular items from other adjacent columns on those rows. As we can see, those redundant items on other columns are now gone as well. We now have a cleaner data table.

Query Editor In LuckyTemplates | An Overview

3. Unpivoting Columns In LuckyTemplates

Another thing that we can fix here are the multiple date columns. What we can do is to put them inside one column instead. We can do that by unpivoting columns

Query Editor In LuckyTemplates | An Overview

First, select the columns that we don’t want to unpivot. Then, right click on the last selected column and choose Unpivot Other Columns

Query Editor In LuckyTemplates | An Overview

We now have our dates inside one column and the sales amount on another column as well.

Query Editor In LuckyTemplates | An Overview

We can now rename these columns as Dates and Sales Amount.

Query Editor In LuckyTemplates | An Overview

Click on the data type icon on the left side of the Sales Amount column. Then, change its data type to Whole Number.

Query Editor In LuckyTemplates | An Overview

Similarly, click on the data type icon on the left side of the Dates column. Then, change its data type to Date.

Query Editor In LuckyTemplates | An Overview

4. Removing Errors In Power Query Editor

For some instances, we might encounter some errors while cleaning up our data. In this example, we have errors under the Dates columns. 

Query Editor In LuckyTemplates | An Overview

This is due to having text values before changing the data type of the columns to Date. As shown from the example below, there’s a summarized information inside the Date column. 

Query Editor In LuckyTemplates | An Overview

We can easily remove those errors by right clicking on our Dates column and choosing the Remove Errors option.

Query Editor In LuckyTemplates | An Overview

As a result, it’ll remove all those errors so we won’t have them on our table anymore. Our table is now much cleaner. 

Query Editor In LuckyTemplates | An Overview

5. Turning A Query Into An Actual Table

Lastly, we need to turn it from a query into an actual table and commit it. Just click the Close & Apply option under the Home tab.

Query Editor In LuckyTemplates | An Overview

We now have a perfect and optimized table for LuckyTemplates. This table looks great in terms of running all of our DAX formula and patterns. 

Query Editor In LuckyTemplates | An Overview

Conclusion

To recap, we’ve taken an ugly worksheet of data and turned it into a refined table that’s perfectly optimized for LuckyTemplates. We can now build a model around it.

Hopefully, this tutorial was enlightening in terms of what we can achieve using Query Editor in LuckyTemplates and why we should always bring our data to the Query Editor first. Even if we only have a small table, there could be something as small as just changing a column name or column data type. We’d want to get used to doing things in the Query Editor first so we can work with various transformations and cleaning procedures to start getting our data optimized. 

All the best,

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.