slice with two max rows or lastest rows

Hi,

I am trying to make a slice to get the two latest rows for each people.

the table 1 is:

Namedate startdate end
john01-02-2130-02-21
peter05-03-2117-03-21
cara01-02-2130-02-21
peter19-03-2120-04-21
cara02-03-2115-03-21
john01-03-2111-03-21
john15-03-2102-04-21
john03-04-2107-04-21
peter23-04-2130-04-21

 

I need to get this slice (the two latest date end)

 

Namedate startdate end
peter19-03-2120-04-21
peter23-04-2130-04-21
john15-03-2102-04-21
john03-04-2107-04-21
cara02-03-2115-03-21
cara01-02-2130-02-21

 

I have tried to modify this expression, but I could not it

 

 

 

(
[_THISROW]
= MAXROW(
"Table 1",
"date end",
([_THISROW].[Name] = [Name])
)

 

 

 

 

 

Solved Solved
0 4 298
1 ACCEPTED SOLUTION

I believe you mean *slice.

1. Have another table People, that contains these columns:

  • "personID", Key column
  • "Name", Label column

2. Your Table1 should contain:

  • "rowID", Key column
  • "personID", Ref column to People
  • remove the "Name" column from this table

3. Add a new virtual column to People, named "latestRecords", type List, with the following App Formula:

TOP(
  ORDERBY(
    FILTER("table1", [personID] = [_ThisRow].[personID]),
    [date end], TRUE, [date start]
  ), 2
)

4. Your Table1 slice filter condition should be:

IN([rowID], [personID].[latestRecords])

View solution in original post

4 REPLIES 4

I believe you mean *slice.

1. Have another table People, that contains these columns:

  • "personID", Key column
  • "Name", Label column

2. Your Table1 should contain:

  • "rowID", Key column
  • "personID", Ref column to People
  • remove the "Name" column from this table

3. Add a new virtual column to People, named "latestRecords", type List, with the following App Formula:

TOP(
  ORDERBY(
    FILTER("table1", [personID] = [_ThisRow].[personID]),
    [date end], TRUE, [date start]
  ), 2
)

4. Your Table1 slice filter condition should be:

IN([rowID], [personID].[latestRecords])

You went the virtual column route!

This is what I could think of, but @graham_howe crafter a better one.

yes! slice

Thank you! @Joseph_Seddik 

 

Top Labels in this Space