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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

RECURSIVELY FINDING ROWS

Hi everyone!

 

I am trying to show rows recursively in my table visual. The table is controlled by a slicer. My data looks like this:

MaheshkumarSuma_0-1714490793630.png

I am using a slicer to show values in the table, the slicer is associated with the first family value `G3MS`. So only first row is getting displayed in the visual. I want to recursively search for subsequent replacements and display the rows as shown.





4 REPLIES 4
Anonymous
Not applicable

@Greg_Deckler , a great solution in Power BI Desktop with DAX.

 

I reviewed this case was created in Power Query forum, so I would like to provide a solution in Power Query.

Here's the steps:

1.Add an index column.

vstephenmsft_0-1714633976035.png

2.Add a custom column.

vstephenmsft_1-1714633997397.png

vstephenmsft_2-1714634010604.png

3.Expand the values and you can see the result.

vstephenmsft_3-1714634046039.png

 

 

Reference:Value from previous row – Power Query, M language – Trainings, consultancy, tutorials (exceltown.com...

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

But this index method may only work if there's a single sequence right? What if I have more families with corresponding replacements? 
Really appreciate your help! 

I used this function:
= (x as text)=>
let a= if List.PositionOf(ModuleList, Text.AfterDelimiter(x, ",", {0, RelativePosition.FromEnd}))<0
then x
else @GetHierarchy(x & "," & ReplacementList{List.PositionOf(ModuleList, Text.AfterDelimiter(x, ",", {0, RelativePosition.FromEnd}))})
in a

This seemed to solve the problem 80%


Greg_Deckler
Community Champion
Community Champion

@Anonymous Do you have anything that you can use to define "later" or "earlier" in your table, like a date or index? If so, you can use the MTBF pattern. See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586.
The basic pattern is:
Column = 
  VAR __Current = [Value]
  VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])

  VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
 ( __Current - __Previous ) * 1.



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I do have date columns (the date on which the family was replaced). I will try this solution out! 

Thanks!!

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.