Forum Discussion

Saichebrolu's avatar
Saichebrolu
Frequent Visitor
3 years ago

Looping Logic

Hello Community, i have a table below.
Need to calculate the count of Newvalue column based on Date selection.
Please observe below output exmple results for your reference.

TABLE:

Prop IDCreated DateOld ValueNew Value
ABC1235/3/2023AcceptedSigned
ABC1234/29/2023PendingAccepted
ABC1234/26/2023AppliedPending
XYZ1234/20/2023AcceptedSigned
XYZ1234/17/2023PendingAccepted
XYZ1234/8/2023AppliedPending


Expecting result example1.

User Selection: 04/15/2023 to 04/30/2023  
    
Report Output   
   Notes:
StatusHomes  
Pending0 We have two homes in our pool which are ABC123 abd XYZ123. When user selects date range 04/15/2023 to 04/30/2023 the number of homes in Pending Status are 0. Because within users date range, the latest status of ABC123 is Accepted and XYZ123 is Signed. 
Accepted1  
Signed1  

Expecting result example2.

User Selection: 04/15/2023 to 05/15/2023  
    
Report Output   
   Notes:
StatusHomes  
Pending0 We have two homes in our pool which are ABC123 abd XYZ123. When user selects date range 04/15/2023 to 04/30/2023 the number of homes in Pending and Accepted Status are 0. Because within users date range, the latest status of ABC123 and XYZ123 is Signed. 
Accepted0  
Signed2  


Please help me out.




Thanks
Saikumar









4 Replies

  • There is no point in letting the user select a date range.  What you want to compute is the status of each property on the last specified date (4/30 or 5/15).

     

    You need to consider a couple of scenarios

     

    - there is a change event before the selected date:  Use the New value

    - there is a change event after the selected date:  use the Old value

    - there is no change event listed for a property:  Here you would need to use the current status of the property, which is missing from your sample data.

     

    This pattern is very common when you deal with field history reports based on Salesforce.com data.

    • Saichebrolu's avatar
      Saichebrolu
      Frequent Visitor

      Hi Ibendlin,  
      Need to count the Newvalue column Dynamically based on  Max Of createddate    in the selected daterange.

      Source table:

      Prop IDCreated DateNew Value
      ABC1235/3/2023Signed
      ABC1234/29/2023Accepted
      ABC1234/26/2023Pending
      XYZ1234/20/2023Signed
      XYZ1234/17/2023Accepted
      XYZ1234/8/2023Pending


      User Selection (Slicer): 04/15/2023 to 04/30/2023 

      1.If User select above Date range
      O/P:

      Prop IDCreated DateNew ValueCount
      ABC 1234/29/2023Accepted1
      XYZ 1234/20/2023Signed1

       

      User Selection (Slicer): 04/17/2023 to 04/20/2023 

      example2:.If User select above Date range
      O/P:

      Prop IDCreated DateNew ValueCount
      ABC1234/26/2023Pending1
      XYZ1234/17/2023Accepted1

       

      Thanks

  • Saichebrolu's avatar
    Saichebrolu
    Frequent Visitor

    Hi Ibendlin,  
    Need to count the Newvalue column Dynamically based on  Max Of createddate    in the selected daterange.

    Source table:
    ---------------

    Prop IDCreated DateNew Value
    ABC1235/3/2023Signed
    ABC1234/29/2023Accepted
    ABC1234/26/2023Pending
    XYZ1234/20/2023Signed
    XYZ1234/17/2023Accepted
    XYZ1234/8/2023Pending

    example1:If User select above Date range
    Expected Result:
    Note: The count should be come under newvalue column based on dynamic maxdate.
    User Selection (Slicer): 04/17/2023 to 04/20/2023 

    Prop IDCreated DateNew ValueCount
    ABC1234/26/2023Pending1
    XYZ1234/17/2023Accepted1

     


    Thanks

    • lbendlin's avatar
      lbendlin
      Super User

      Please provide sanitized sample data that fully covers your issue.
      Please show the expected outcome based on the sample data you provided.