Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

This tutorial will talk about a common scenario that’s frequently asked in the LuckyTemplates support forum. You’re going to learn how to work out the most recent or the last value in your data using the and DAX functions in LuckyTemplates. You may watch the full video of this tutorial at the bottom of this blog.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

For this example, there’s a list of data and within that list the customer is referenced multiple times. So, you want to work out the recent value for that particular customer name.

The example presented in the forums was in the form of a survey data. You want to work out the most recent or the last time that a particular customer took the survey.

There are a couple of ways to solve this. You can perform the solution using calculated columns or measures.

Using a Calculated Column gives more aesthetic while using a Measure allows your models to be more dynamic.

Here’s how to work out the most recent date for any dimension in your data set using two solutions.

Table of Contents

Solution #1: Using Calculated Columns

Here’s how to solve the problem using Calculated Columns.

1. Create A New Column

The first step is to create a new column in the table that was given as an example in the forums. This new column will contain the Max Date.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

This is the logic used on the formula for the Max Date:

Whenever you encounter problems in LuckyTemplates that require the maximum date or number, the MAXX DAX function is the best one to use.

This function is the key in creating the solution for this example.

2. Create A Variable

Now, you need to create a new variable using the function. In this example, the new variable is called CurrentName.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

For each different row, you want to work out the name of each person. This part is quite easy since you simply need to reference the column name in a Calculated Column.

At every single row, you only want to isolate the people with the same name as the current row.

Looking at the table, you can see that it has three different names with two entries for each name.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

You need to isolate those names and then work out the maximum date that a particular person has transacted with you. The transaction could be in terms of completing a purchase or survey.

3. Create A FILTER Statement

To isolate the names, you first need to use the FILTER and function.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

This will remove all the filters within the table. This will also iterate through every single row regardless of context.

Then, you need to work out if the Name in the Survey Data is equal to the CurrentName variable.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

4. Use The MAXX Function

Now, the MAXX DAX function is going to get a table containing only two rows. This is the result of filtering and iterating through each row to find out if the name is equal to the current name. In this case, the current name is John Smith.

You then need to evaluate the max. The MAXX DAX function calculates the max for you. So, all you need to do is put the column in the formula:

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

When you change the Max Date column’s format into a date, you’ll see that the max date for John Smith is February 23.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

The max date for Nancy Jones is September 25, while it’s September 22 for Elaine Anderson.

This is a very simple technique and its logic can be applied to different scenarios. You can use this to find out the last purchase or sale amount.

Solution #2: Using A Measure

Here’s how to solve this problem using Measures.

Using measures allows you to work out the last date and then branch out into other calculations.

This is the best way to run any calculations in LuckyTemplates.

1. Create A Table

First, you need to create a table.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

This table only contains two columns. The information contained in the other columns are irrelevant for this calculation.

2. Create A New Measure

You then need to create a new measure.

This measure has the same formula that was used in the calculated columns solution. However, you need to change the Survey table to Survey Data.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

And instead of simply referencing the column name, you need to use the function.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data

This captures what context you’re in.

SELECTEDVALUE enables you to grab the text value from its context.

This technique is also very dynamic compared to other calculations since you can take out the date column and only retain the Max Date for each customer.

Using The MAXX DAX Function In LuckyTemplates To Calculate Most Recent Values Or Last Value In Your Data


First Purchase Of Customer Insight Using DAX
Last Purchase Date In LuckyTemplates: When Did Your Customers Make Their Last Purchase?
Working With Iterating Functions In DAX

Conclusion

Solutions don’t have to be difficult. They can be done using simple ways.

For this example, you can either go for the Calculated Columns solution, or use Measures.

Hopefully, you understood the concept of how to manipulate the virtual table within the MAXX DAX function.

You can also use the FILTER function to iterate through information and then adjust the virtual table based on the parameter you put into the FILTER statement. MAXX will then do the work from here.

All the best,

***** 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.