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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need to display second row data into first row using DAX Expression

I am looking Next Date column value as per below table, I have three rows in table those are create using summarizedrows function. I am able to get previous value uisng Earlier fucntion but unable to get NEXT DATE column values.

 

prasoonaM_0-1613322047002.png

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

I am not sure of where my suggestion will plug into your existing table function, but on a physical input table, this calculated column formula should get you your desired result

=calculate(min(data[date]),filter(data,data[name]=earlier(data[name])&&data[date]>earlier(data[date])))

Hope this helps.


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

View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

@Anonymous I would highly recommend adding as a measure, the expression I shared can be used to add as a measure as well. You are absolutely right that on a larger dataset the solution provided by @Ashish_Mathur  will be very slow.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k , Created as a measure,Date column values are not coming as expected some are showing incorret values. Thanks for the sugesstions I will try  to check and correct mesaure logic to show correct results

Ashish_Mathur
Super User
Super User

Hi,

I am not sure of where my suggestion will plug into your existing table function, but on a physical input table, this calculated column formula should get you your desired result

=calculate(min(data[date]),filter(data,data[name]=earlier(data[name])&&data[date]>earlier(data[date])))

Hope this helps.


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

Thanks Ashish, Solution is working as expected

You are welcome.


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

@Anonymous use the following expression to add a new column:

 

Next Date = 
VAR __table = ALLEXCEPT ( 'Next', Next[Name] )
VAR __version = CALCULATE ( MAX ( Next[Version] ) )
VAR __nextDate = 
CALCULATE ( 
    MIN ( Next[Date] ),
    __table,
    Next[Version] > __version
)
RETURN __nextDate

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k , Getting Dependency Error and create new date column and implemented the above logic still getting same error, @Ashish_Mathur  solution is working as expected, Only concern is poerformace on larger dataset how it will work because using comparison in filter condition, which one is good new coloumn or measure option

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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