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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Shinyl
New Member

Revenue in max date

I have 2 tables

Ddate

DateMonthMonth Year
4/1/20244April 2024
3/1/20243Mar 2024
4/28/20244April 2024
3/3/20243Mar 2024
4/27/20244April 2024
4/29/20244April 2024
4/30/20244April 2024

Revenue

ValueRecord DateCustomer
303/1/2024A
1003/1/2024C
2004/27/2024A
304/28/2024A
604/27/2024C
804/27/2024B
404/28/2024B
503/1/2024B
904/28/2024C

They are both connected by Date-Record date

I want to create a measure for revenue value at the maximum date in Revenue table, ignoring the Monthyear filter

For example, if i selected Mar 2024, and customer C, I want to show the revenue on the max date (04/28/2024), which is 90.

Shinyl_1-1725204855191.png

when i used 

MAXX(ALLSELECTED(Revenue[RecordDate]),Revenue[RecordDate])) the max date is correct.
but when I apply this max date to calculate the sum of revenue, it does not show the expected value:
 CALCULATE(SUM(Revenue[Value]), FILTER(DDate,DDate[Date] =MAXX(ALLSELECTED(Revenue[RecordDate]),Revenue[RecordDate]))
 

Thank you in advance!

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@Shinyl Try:

 

 

Measure =
  VAR __MaxDate = MAXX(ALL(Revenue[RecordDate]),Revenue[RecordDate]))
  VAR __Result = SUMX( FILTER( ALLEXCEPT('Revenue', [Customer]), [RecordDate] = __MaxDate ), [Value] )
RETURN
  __Result

 

 



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

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1725234424683.png

 


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

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1725234424683.png

 


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

@Shinyl Try:

 

 

Measure =
  VAR __MaxDate = MAXX(ALL(Revenue[RecordDate]),Revenue[RecordDate]))
  VAR __Result = SUMX( FILTER( ALLEXCEPT('Revenue', [Customer]), [RecordDate] = __MaxDate ), [Value] )
RETURN
  __Result

 

 



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

Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Top Solution Authors