cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AS31 Member
Member

Find the rent based on date selected via filter

Hello everyone,

 

I have two tables namely,

Rent_Entity and Rent_Modification.

Rent Entity has all the information about the tenant/contract. Rent Modification is for any rent increase/decrease happened on the contract level.

 

Now let's say, if I have to select the rent roll for today, I will get all the latest data for the specific contract. But If someone asks me to provide the rent roll on a specific date in past, I need to have the rent for specific contract at that point of time.

 

For eg.

 

rent_entity    
idContract_Nametotal_renteinzugauszug
1070_M_05.01568.901-11-1980 

 

 

rent_modification      
contract_idold_valuenew_valuedifferencestatestart_dateend_dateKind
10518.9568.950approved1-Feb-19 RENT
10468.9518.950approved1-Feb-19 RENT
1010512520draft4-Feb-19 BK

 

If I take the rent roll for this contract 70_M_05.01, it will give me the rent 568.9 but If I need the rent roll in jan 2019 or in any past date then the rent should show 468.9 as you can see in the old_value of rent_modification table. I also have to have include certain criteria like state = "approved" and Kind = "RENT".

 

 

@Ashish_Mathur @Greg_Deckler  @Zubair_Muhammad 

 

Please Help!!!!!

4 REPLIES 4
Super User
Super User

Re: Find the rent based on date selected via filter

Hi @AS31 

 

I see something strange in your second table, should not the second row have an end date? Should not the 'start_date' be different between the first row and the second row? 

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

AS31 Member
Member

Re: Find the rent based on date selected via filter

Hi @LivioLanzo ,  It's correct. Somtimes because of some faulty entries we have this kind of data in the db. We don't have end_date for RENT increase because it's a one time increment. End_Date is for other kind of Rent Increase/Decrease where we do certain amount increment/decrement each month for a period of time. For eg. Rent reduction because of something broke in the apartment then we give tenants a discount on rent for few months.

Highlighted
Super User
Super User

Re: Find the rent based on date selected via filter

Hi,

 

Why should the rent for Jan 2019 be 468.9?  In that row, i do not see the date of Jan 2019 at all.

AS31 Member
Member

Re: Find the rent based on date selected via filter

Hi @Ashish_Mathur . Since the rent increment was happened on 1st Feb 2019 as you see in the rent_modification table. So if I need the rent roll for Jan it should be the previous rent before the increment which is 468.9 in the old_value column.