Forum Discussion
greta
2 years agoFrequent Visitor
List.Accumulate or what?
Dear All, thank you for your time. I have a request that seems really complicated to me, I don't know if it's achievable. I've recreeated the data I'm working with in a simplified table that I'm po...
- 2 years ago
greta I did not consider the case when all values are On Hold. Try this instead:
let Source = Lista_OnHold, z = Table.Group( Source, {"MercatusCode"}, {{ "On_Hold", each [lst = Table.Sort(_, {"Index.1", Order.Descending})[ProjectStatusInternal.1], pozz = List.PositionOf(lst, "On Hold", Occurrence.First, (x, y) => x <> y), zz = if pozz = -1 then List.Count(lst) else pozz][zz] }} ) in z
AlienSx
2 years agoSuper User
Hello, greta
let
Source = simplified_table,
z = Table.Group(
Source, {"prog"},
{{
"on_hold",
each List.PositionOf(
Table.Sort(_, {"index", Order.Descending})[status],
"on hold",
Occurrence.First,
(x, y) => x <> y
)
}}
)
in
z- greta2 years agoFrequent VisitorMany thanks, that's exactly what I needed!
- greta2 years agoFrequent Visitor
I've adapted the query to the following dataset,
As follows:
letSource = Lista_OnHold,z = Table.Group(Source, {"MercatusCode"},{{"On_Hold",each List.PositionOf(Table.Sort(_, {"Index.1", Order.Descending})[ProjectStatusInternal.1],"On Hold",Occurrence.First,(x, y) => x <> y)}})inz
And I'm getting this resultCould you help me in understanding why?
Many thanks in advance- AlienSx2 years agoSuper User
greta I did not consider the case when all values are On Hold. Try this instead:
let Source = Lista_OnHold, z = Table.Group( Source, {"MercatusCode"}, {{ "On_Hold", each [lst = Table.Sort(_, {"Index.1", Order.Descending})[ProjectStatusInternal.1], pozz = List.PositionOf(lst, "On Hold", Occurrence.First, (x, y) => x <> y), zz = if pozz = -1 then List.Count(lst) else pozz][zz] }} ) in z- greta2 years agoFrequent Visitor
Works perfectly, many thanks!