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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Rajat529
New Member

Conditional Column

Hi There

 

I m new to Power BI and need Dax to achieve the output below.

 

In the dateset i want to add new column output where i want leads from the latest date of same ids and for the earlier date output should be blank as shown below.

 

DateLeadsIdOutput
9/12/2022561 
9/19/2022231 
9/26/2022451 
10/3/2022211 
10/10/2022221 
10/17/2022231 
11/24/202245145
9/12/2022562 
9/19/2022232 
9/26/2022452 
10/3/2022212 
10/10/2022222 
10/17/2022232 
11/24/202256256

 

Any help would be appreciated.

 

Regards

Rajat

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Rajat529 ;

Try this column by dax.

Output2 = 
var _maxdate= CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Id]))
return IF([Date]=_maxdate,[Leads])

 The final show:

vyalanwumsft_0-1663660756472.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Rajat529 ;

Try this column by dax.

Output2 = 
var _maxdate= CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Id]))
return IF([Date]=_maxdate,[Leads])

 The final show:

vyalanwumsft_0-1663660756472.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Super User
Super User

@Rajat529 Try:

Column Output =
  VAR __ID = [Id]
  VAR __LastDate = MAXX(FILTER('Table',[Id] = __ID),[Date])
RETURN
  MAXX(FILTER('Table',[Id] = __ID && [Date] = __LastDate),[Leads])


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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

 

This is very near to the solution but I m not getting blank() in the earlier dates rather i m getting like below

 

DateMonthNr LeadsIDSlatest_lead

Monday, September 12, 2022September56145
Monday, September 19, 2022September23145
Monday, September 26, 2022September45145
Monday, October 3, 2022October21145
Monday, October 10, 2022October22145
Monday, October 17, 2022October23145
Thursday, November 24, 2022November45145
Monday, September 12, 2022September56256
Monday, September 19, 2022September23256
Monday, September 26, 2022September45256
Monday, October 3, 2022October21256
Monday, October 10, 2022October22256
Monday, October 17, 2022October23256
Thursday, November 24, 2022November56256

 

see latest_lead in the last column i m getting through your dax.

 

can you please update?

 

Thanks

Rajat

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.