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
Anonymous
Not applicable

Calculated Column Based on 4 Columns

Hello,

 

I have the following table,

 

office Nameuser IDUser Statususer Activated on
O1U1Completed20-Sep
O1U2In Progress19-Sep
O1U3Completed18-Sep
O1U4New 
O2U5Completed15-Sep
O2U6In Progress14-Sep
O2U7New 
O3U8In Progress14-Sep
O3U9New 

 

I want to calculate a column called USER such that table looks like this,

 

office Nameuser IDUser Statususer Activated onUSER
O1U1Completed20-SepU3
O1U2In Progress19-SepU3
O1U3Completed18-SepU3
O1U4New U3
O2U5Completed15-SepU5
O2U6In Progress14-SepU5
O2U7New U5
O3U8In Progress14-Sep 
O3U9New  

 

The User Column is nothing but the User ID in each office having user status as "Completed" and having the earliest user activated date.

 

For Example, for O1 --> U1 and U3 are in completed status, but U3 has activated earlier than U1 that is on 18th sept. So calculated column user should have value as U3.

For O2, the only user who has completed status is U5 so user will have U5

for O3, nobody has the completed status so it remains empty.

 

Please help me with DAX query

@Ashish_Mathur 

 

 

Thanks, 

Dharani

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Anonymous Maybe:

USER Column =
  VAR __Office = [office Name]
  VAR __Table = FILTER('Table',[office Name] = __Office && [User Status] = "Completed")
  VAR __Min = MINX(__Table,[User Activated on])
RETURN
  MAXX(FILTER(__Table,[User Activated On] = __Min),[user])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=LOOKUPVALUE(Data[user ID],Data[user Activated on],CALCULATE(MIN(Data[user Activated on]),FILTER(Data,Data[office Name]=EARLIER(Data[office Name])&&Data[User Status]="Completed")),Data[office Name],Data[office Name])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

@Anonymous Maybe:

USER Column =
  VAR __Office = [office Name]
  VAR __Table = FILTER('Table',[office Name] = __Office && [User Status] = "Completed")
  VAR __Min = MINX(__Table,[User Activated on])
RETURN
  MAXX(FILTER(__Table,[User Activated On] = __Min),[user])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors