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
vrossouw
Helper III
Helper III

Calculate on row below current row

https://drive.google.com/drive/folders/1Vd3I930HLd8xfV5nnZH_SvI7BzMHXSfv?usp=sharing

 

Hi, I am trying to base a calculation on the row below the current line.

I have saved the excel file in Google Drive - please see the link.

 

Split Route  Scrap Gross Gross2Grossed up100%
010770AGAE0.15         1.102           1.00       110.21       100.00
010770AGAE1.8         1.100           0.98       110.05               -  
010770AGAE0.5         1.081           1.00       108.07               -  
010770AGAE7         1.075           0.93       107.53               -  
010780AGBE0.15               -             1.00               -         100.00

 

Column E (Grossed Up) has got a formula in Excel which looks at the row below the current row.

How can I get the same result in Power BI?

Thank you for your time.

Regards

Vicky

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey, basically, you can't, because there is no concept of ordered rows. A table in Power BI or SSAS Tabular has to be considered a heap, an unordered number of rows. This is similar to a table (w/o an index) in a relational database. For this reason, you have to provide an index, e.g. using Power Query, after you have sucessfully ordered the rows. Then you can use the DAX function LOOKUPVALUE(''[columntoreturn], ''[indexcolumn],''[indexcolumn]+1) to access the rows below, assuming the rows have been numbered in ascending order, otherwise it would be -1 Regards, Tom


Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

1 REPLY 1
TomMartens
Super User
Super User

Hey, basically, you can't, because there is no concept of ordered rows. A table in Power BI or SSAS Tabular has to be considered a heap, an unordered number of rows. This is similar to a table (w/o an index) in a relational database. For this reason, you have to provide an index, e.g. using Power Query, after you have sucessfully ordered the rows. Then you can use the DAX function LOOKUPVALUE(''[columntoreturn], ''[indexcolumn],''[indexcolumn]+1) to access the rows below, assuming the rows have been numbered in ascending order, otherwise it would be -1 Regards, Tom


Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.