Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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.

 

 

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

7 Replies

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Ashish, Solution is working as expected

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

    • Anonymous's avatar
      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

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

    • Anonymous's avatar
      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