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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
siwfy
Microsoft Employee
Microsoft Employee

How to achieve the function of arg_max() from Kusto

Hi all, I am new to Power BI and I need some help with DAX here. I have an existing table like this:

siwfy_0-1706107364239.png

 

I need to create a new table based on column [CreatedDate], extracting the latest records for each Site. From the example above, the latest record for Site A is from 1/1/2024 and Site B from 11/1/2023, giving us the new table as follows:

siwfy_1-1706107409300.png

 

 

In Kusto, we can achieve this easily with arg_max() operator. I wonder anyone can help me compose the DAX query here. It would be much appreciated.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1706118720647.png

 

 

expected result table = 
CALCULATETABLE (
    Data,
    TREATAS (
        GROUPBY (
            Data,
            Data[Site],
            "@maxdate", MAXX ( CURRENTGROUP (), Data[CreatedDate] )
        ),
        Data[Site],
        Data[CreatedDate]
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1706118720647.png

 

 

expected result table = 
CALCULATETABLE (
    Data,
    TREATAS (
        GROUPBY (
            Data,
            Data[Site],
            "@maxdate", MAXX ( CURRENTGROUP (), Data[CreatedDate] )
        ),
        Data[Site],
        Data[CreatedDate]
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
siwfy
Microsoft Employee
Microsoft Employee

@Jihwan_Kim Thank you, you are a lifesaver.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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