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

Calculated Column by Other Column

Hi all, I'm having trouble coding this column...

 

my data behaves like this:

maTank_0-1691399463864.png

and I want to add a new column that will return the Event with the max date, per Subject

like this:

maTank_1-1691399521578.png

I can't go into the details, the data is proprietary... This is a mock-up of only what I need, and only 3 subjects.

1 ACCEPTED SOLUTION
rubayatyasmin
Super User
Super User

Hi, @Anonymous 

 

I tried to reproduce the problem. 

 

I used the dax below

 

Max Event = 
VAR CurrentSubject = Table1[Subject]
VAR MaxDate = 
    CALCULATE(
        MAX(Table1[Event Date]), 
        FILTER(
            Table1, 
            Table1[Subject] = CurrentSubject
        )
    )
RETURN 
    CALCULATE(
        MAX(Table1[Event]),
        FILTER(
            Table1,
            Table1[Subject] = CurrentSubject && Table1[Event Date] = MaxDate
        )
    )

 

result:

rubayatyasmin_0-1691402644436.png

 

rubayatyasmin_0-1689517080227.png

 


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


View solution in original post

3 REPLIES 3
rubayatyasmin
Super User
Super User

Hi, @Anonymous 

 

I tried to reproduce the problem. 

 

I used the dax below

 

Max Event = 
VAR CurrentSubject = Table1[Subject]
VAR MaxDate = 
    CALCULATE(
        MAX(Table1[Event Date]), 
        FILTER(
            Table1, 
            Table1[Subject] = CurrentSubject
        )
    )
RETURN 
    CALCULATE(
        MAX(Table1[Event]),
        FILTER(
            Table1,
            Table1[Subject] = CurrentSubject && Table1[Event Date] = MaxDate
        )
    )

 

result:

rubayatyasmin_0-1691402644436.png

 

rubayatyasmin_0-1689517080227.png

 


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Anonymous
Not applicable

perfection, thank you!

DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

you could try something like this:

 

column = var _maxdate = CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Subject]))
return
CALCULATE(VALUES('Table'[Event]),'Table'[Date]=_maxdate,ALLEXCEPT('Table','Table'[Subject]))
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Helpful resources

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