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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Seperate table with only the Max Value For every unique combination of other Columns

Hello!

 

I have a table that start with a Name and a Type. They also have a date of entrt. A bit like this

 

Date entry.NameTypeOther Data
01-01-2021 .AAA1 
01-01-2022 .AAA1 
02-01-2022  .BBB1 
02-01-2022  .BBB2 
01-01-2021  .CCC1 
01-01-2022  .CCC1 
01-01-2022  .CCC2 

 

 

I need to make a table that only contains the rows that have the Max date of entry for all combinations of Name and Type.

 

I tried making a calctulated table that contained each unique combination of Name and Type, and then calculated what its max Date was. I was succesfull at this. Sadly i then noticed i was unable to use this calculated table in further Dax formules when making a new table. Why is this and is there a way around this?

Or is there a better way all together? 

 

The calculated table that i made would have looked like 

NameTypeMax date Entry
AAA101-01-2022
BBB102-01-2022
BBB202-01-2022
CCC101-01-2022
CCC201-01-2022

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous 
Please try

HighestData =
VAR T1 =
    ADDCOLUMNS (
        'Data table',
        "Max Entry Date",
            CALCULATE (
                MAX ( 'Data table'[Date] ),
                ALLEXCEPT ( 'Data table', 'Data table'[Name], 'Data table'[Type] )
            )
    )
VAR T2 =
    SELECTCOLUMNS (
        T1,
        "Name", [Name],
        "Type", [Type],
        "Date", [Date],
        "Max Entry Date", [Max Entry Date]
    )
RETURN
    T2

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hello @Jos_Woolley  and @tamerj1 

That Summerize function is indeed the function i use to create a table that only contains the highest Date for every combination. 

Now i need a table that contains all rows from the origenal table that have that Max Highest Date for every combination.

 

When i try to make a new table i try to write the following line:

HighestData = Filter("Data table",
And(And(
"Data table"[Name]="Max Date Table"[Name],
"Data table"[Type]="Max Date Table"[Type],
"Data table"[Entry Date]="Max Date Table"[Max Entry Date]
)))

But it says i cannot select this column from the Max Date Table

Hi @Anonymous 
Please try

HighestData =
VAR T1 =
    ADDCOLUMNS (
        'Data table',
        "Max Entry Date",
            CALCULATE (
                MAX ( 'Data table'[Date] ),
                ALLEXCEPT ( 'Data table', 'Data table'[Name], 'Data table'[Type] )
            )
    )
VAR T2 =
    SELECTCOLUMNS (
        T1,
        "Name", [Name],
        "Type", [Type],
        "Date", [Date],
        "Max Entry Date", [Max Entry Date]
    )
RETURN
    T2
Anonymous
Not applicable

Thanks @tamerj1 

 

Not exactly your solution, but based on your solution this formula gave me what i needed!

HighestData =
VAR T1 =
    ADDCOLUMNS (
        'Data table',
        "Max Entry Date",
            CALCULATE (
                MAX ( 'Data table'[Date] ),
                ALLEXCEPT ( 'Data table', 'Data table'[Name], 'Data table'[Type] )
            )
    )
RETURN
FILTER(T1, [Max Entry Date]='Data table'[Entry Date])
tamerj1
Super User
Super User

Hi @Anonymous 

Please use 

NeW Table =
SUMMARIZE (
    TableName,
    TableName[Name],
    TableName[Type],
    "Max Date", MAX ( TableName[Date] )
)
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Can you clarify "i was unable to use this calculated table in further Dax formules when making a new table"? Why not? What message did you receive? And what was your DAX for generating your calculated table?

Regards

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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