March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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 | ||||
id | Contract_Name | total_rent | einzug | auszug |
10 | 70_M_05.01 | 568.9 | 01-11-1980 |
rent_modification | |||||||
contract_id | old_value | new_value | difference | state | start_date | end_date | Kind |
10 | 518.9 | 568.9 | 50 | approved | 1-Feb-19 | RENT | |
10 | 468.9 | 518.9 | 50 | approved | 1-Feb-19 | RENT | |
10 | 105 | 125 | 20 | draft | 4-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!!!!!
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.
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.
Hi @Anonymous
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!
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
127 | |
85 | |
69 | |
53 | |
44 |
User | Count |
---|---|
202 | |
106 | |
100 | |
64 | |
56 |