1 Reply Latest reply on Aug 23, 2017 1:04 AM by Hardik Mohta

    Calculate index grouped by multiple attributes

    Hardik Mohta

      Hi there,

       

      I have a dataset mentioned below having ID, pid, Status and Date columns.

      ID is set as unique ID for the record according to the timestamp (date) it has been pushed in the system.

      Pid is a unique ID for a person which goes through different status.

       

      | ID | pid | Status | Date      |

      |1   |1     |   in       |1-1-97     |

      |2   |2     |   out     |2-2-97     |

      |3   |1     |   in       |3-5-97     |

      |4   |2     |   in       |9-9-97     |

      |5   |1     |   in       |10-12-97 |

       

       

      I want another column which can give an index grouping by pid for every status in the order of ascending timestamp(date).

       

      Note: A particular status can have multiple dates also.

       

      Index | ID | pid | Status | Date |

       

      1   | 1  | 1    |   in       |1-1-97     |

      1   | 2  | 2    |   out     |2-2-97     |

      2   | 3  | 1    |   in       |3-5-97     |

      2   | 4  | 2    |   in       |9-9-97     |

      3   | 5  | 1    |   in       |10-12-97 |

       

      Thanks