Forum Discussion
ZigZag pattern as new Column for ID
Hi,
I am looking for ZigZag pattern for the report,
I have this
I would like to show table like this
Thanks
This can be done with a DAX measure but you will need 2 extra things in your data:
- A date column that indicates when the entry was made
- A record for the first version of the "Op".
Here is the datatable i made which i just called "Data"
Here is the measure:
Pattern = CONCATENATEX(Data, Data[CurrentOp], " -> ", Data[Date], ASC )Here is the output in a table visual:
7 Replies
- danextian
Super User
Hi damit230183
Assuming the rows are ordered chronologically, create an index column in Power Query to identify which row comes first if there isn't any column in your table that indicates such
Then try this:
Pattern = VAR _CurrentID = 'Table'[id] -- Isolate all rows for the current ID VAR _RelatedRows = FILTER ( ALL ( 'Table' ), 'Table'[id] = _CurrentID ) -- Find the true starting row (highest Index = bottom row = Index 1) VAR _MaxIndex = MAXX ( _RelatedRows, 'Table'[Index] ) -- Extract the starting PrevOp (3 from Index 1) VAR _StartNode = LOOKUPVALUE ( 'Table'[PrevOp], 'Table'[id], _CurrentID, 'Table'[Index], _MaxIndex ) -- Concatenate CurrentOp from bottom to top (Index 1 then Index 0) VAR _Chain = CONCATENATEX ( _RelatedRows, 'Table'[CurrentOp], " -> ", 'Table'[Index], DESC ) RETURN _StartNode & " -> " & _ChainPlease see the attached pbix.
Note: solution was done with the help of AI.
- damit230183
Helper II
Hi,
Thanks for your response.
So i am using direct query due to very high db volume (atleast 5 Mil everyday). So some of the syntax like Index, ConcatenateX etc I can not use.
Thanks
- danextian
Super User
Unfortunately, your requirement requires iteration which isn't supported in Direct Query. If you have that big of a data, I wouldn't do a full load each refresh but use incremental refresh instead.
- RossEdwardsRio
Resolver I
This can be done with a DAX measure but you will need 2 extra things in your data:
- A date column that indicates when the entry was made
- A record for the first version of the "Op".
Here is the datatable i made which i just called "Data"
Here is the measure:
Pattern = CONCATENATEX(Data, Data[CurrentOp], " -> ", Data[Date], ASC )Here is the output in a table visual:
- v-saisrao-msft
Community Support
Hi damit230183,
Have you had a chance to review the solution shared by danextian RossEdwardsRio ? If the issue persists, feel free to reply so we can help further.
Thank you.
- v-saisrao-msft
Community Support
Hi damit230183,
Checking in to see if your issue has been resolved. let us know if you still need any assistance.
Thank you.