Identify upgrade/downgrade a record in a list

Hi,

 

Please go through the attached file. 

 

 here each userid has a plan and start /end date of each plan. User can upgrade/downgrade their plan. here i m looking at the solution where i can identify which is the latest plan for unique userId to consider them for the pricing.

Ex : User1  has A plan . after that he has upgraded to C plan. I want to identify that this is the latest plan to the current month.

 

Please help me with this.

 

Thanks,

Geet.

Tagged:

Answers

  • Geet,

     

    Try this out.  

     

    What was given (I used Row as the "row dimension" as none was given):2018-11-16_16-05-54.png

     

     

    In the above, the User and Plans line items are list formatted line items where Plans has a Top Level Item defined (All Plans).

    Create a module that is dimensionalized by Users (I call it People) and Plans with 3 line items: Start Date, End Date, and Plans Item.2018-11-16_16-25-48.png

    The formulas are:

    •  Start Date: Geet.Start Date[MAX: Geet.User, MAX: Geet.Plans]
    • End Date: Geet.End Date[MAX: Geet.User, MAX: Geet.Plans]
    • Plans Item: IF ISBLANK(Start Date) THEN BLANK ELSE IF Start Date = Start Date[SELECT: Plans.All Plans] THEN ITEM(Plans) ELSE BLANK

    Set the Summary of the line items to be:2018-11-16_16-18-19.png

     

    Create the Results module dimensionalized by People (users in the first picture) with Plan, Start Date, and End Date as line items.2018-11-16_16-30-36.png

     

     

    Hope this helps,

    Rob

  • Hi @geet.patel,

     

    @rob_marshall's approach is a really good one.  See below for another approach you could take:

     

    This is a really great opportunity to use the power of saved views and sorting.  What I would do to solve this problem is the following:

    1. In the module where you have your data (let's call it Module 1), sort your dates from "highest to lowest".  This will present the dates from latest date to earliest date.
    2. Click View -> Save As... to save the sorted view of the module as a Saved View.
    3. Create a new module (let's call it Module 2) dimensionalized by a UserID List and Line Items, where the line items are Plan, Subscription Start Date, and EndDate.  Make sure you format those correctly.
    4. On Module 2, click Data -> Import.  Import data from the Saved View of Module 1, making sure to configure the import correctly.  Most importantly, make sure to map the UserID text field from Module 1 into the UserID List in Module 2.
    5. When you import from the Saved View, only the first records of each UserID will make it into Module 2.  Since your saved view is sorted from latest to earliest, that means that only the latest records of each UserID will be brought into that module.

    Screenshot1_11162018.pngScreenshot2_11162018.png

     

    As always, there's loads more that you can do to make the process more efficient, but this is the basic premise.  See attached images for the results!

     

    Hope this helps,

    Zaf

  • @zafkamar

    While that will work, it relies on an aciton which could lead to concurrency issues.  Also, this will create a debug log as the action will not have green checks (clean load).  Lastly, for the information to be updated, you will have to run this action, so the perferred way should be using formula's (less concurrency issues).

     

    Thanks,

    Rob

  •  Hi, 

     

    I think it is needed a basic assumption: the "Valid From", "Valid To" intervals, for the same user, cannot have days in common, otherwise for the common days you can have "valid" in the same time 2 "Plan", which I do not think it is the case. 

     

    Based on the above assumption and considering that the current month can be considered as a "Current Date" defined in a general module as parameter you can have this solution:

     - Current Date is Apr 12th 2018 in the module DP01

    - Import all data in a numbered list in the module OP01

    - formula "Current Plan" in OP01: 

         IF 'DP01. Paremters'.Current Date >= Valid From AND 'DP01. Paremters'.Current Date < Valid To THEN Plan ELSE BLANK

     

    - Formula of "Current Plan" in OP02

        'OP01. ALL Data'.Current Plan[FIRSTNONBLANK: 'OP01. ALL Data'.User Id]

     

    Below a print-screen with the results presented in a dashboard:

     

     

    Capture.JPG

    Let me know if this is what you wanted

     

    Ciao

    Alex