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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
castroeb
Frequent Visitor

Calculate last value in a row

Hi all, 

 

does any one know what can i do calculate the last value of a row?  I have created a matrix where is constanly changing WoW, in columns I have the week when I get the data and in rows I have the weeks that are being affected. for example in the SS below I want to add a mesure to calculate what would be the last value in the row of March 2nd  which would be 11790, how can I do that? 

 

Capture.PNG

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

So perhaps something like:

 

Max Week Received Phr = 
  VAR __Week = MAX('Sheet1'[Week])
  VAR __Table = FILTER(ALL('Sheet1'),[Week] = __Week)
  VAR __MaxWeekReceived = MAXX(__Table,[Week Received])
RETURN
  MAXX(FILTER(__Table,[Week Received] = __MaxWeekReceived),[Phr])

 

Sample data as text always helps to test. The above code is not tested. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

So perhaps something like:

 

Max Week Received Phr = 
  VAR __Week = MAX('Sheet1'[Week])
  VAR __Table = FILTER(ALL('Sheet1'),[Week] = __Week)
  VAR __MaxWeekReceived = MAXX(__Table,[Week Received])
RETURN
  MAXX(FILTER(__Table,[Week Received] = __MaxWeekReceived),[Phr])

 

Sample data as text always helps to test. The above code is not tested. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

thank you Greg, I just tested the code you shared and it works perfectely. exactly what I was looking for. 

thank you once again for your help. 😀

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors