Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Tock
New Member

Calculate Rent per month over time

Hello,

I would like to show the progression of the rent over time. The following table serves as an example:

CustomerCustomer RentStart DateEnd Date
AA10001.03.2021 
BB20001.08.202131.10.2024
CC15001.06.2022 
DD25001.02.2023 
EE5001.05.2024 
FF18001.02.2025 

 

Now I would like to calculate the total income per month and per year to show the development in 2 charts per month or per year. Months or years where there was no change should still be displayed so that a continuous timeline is shown.

For the rental income per year, the result would be (manually calculated, assuming 2 monthly rents are due in 2025):

 

Rent yearly |Amount |How result is calculated
20212000  100 * 10 + 200*5
20224650  100*12+200*12+150*7
20238150  100*12+200*12+150*12+250*11
20248400  100*12+200*10+150*12+250*12+50*8
20251280  100*2+150*2+250*2+50*2+180*1

 

How could I achive this?

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could create a measure like

Rent = 
VAR MinDate = MIN( 'Date'[Date] )
VAR MaxDate = MIN( MAX( 'Date'[Date] ), EOMONTH( TODAY(), -1 ) )
VAR SummaryTable = GENERATE(
	SELECTCOLUMNS(
		Rent,
		Rent[Customer],
		Rent[Customer Rent],
		"@StartDate", Rent[Start Date],
		"@EndDate", COALESCE( Rent[End Date], MaxDate )
	),
	FILTER(
		DATESBETWEEN( 'Date'[Date], [@StartDate], [@EndDate] ),
		DAY( 'Date'[Date] ) = DAY( [@StartDate] )
	)
)
RETURN SUMX( 
	FILTER(
		SummaryTable, 
		'Date'[Date] >= MinDate && 'Date'[Date] <= MaxDate
	),
	Rent[Customer Rent] 
)

For each customer it generates a list of dates when the rent would be due, and then sums all those rents which are due during the selected period.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

HI @Tock,

Any update on this? Did these suggestion helps?

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Hi @Tock ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

danextian
Super User
Super User

Hi @Tock 

 

Create a dates table that is disconnected (without a relationship) from you rent table. The DAX formula below creates a table of dates from the min start date up to the end of the previous month based on today's date.

Dates = 
VAR _End = EOMONTH ( EDATE ( TODAY (), -1 ), 0 )
RETURN
ADDCOLUMNS (
    CALENDAR ( MIN ( 'Rent'[Start Date] ), _End ),
    "Year", YEAR ( [Date] ), "Year Month", FORMAT( [Date], "YYYY-MM" )
)

danextian_0-1741263457335.png

Create these measures:

Rent = 
VAR _BlankDate =
    EOMONTH ( EDATE ( TODAY (), -1 ), 0 )
VAR _ValidDates =
    SUMMARIZE (
        FILTER (
            Dates,
            Dates[Date] >= MINX ( Rent, Rent[Start Date] )
                && Dates[Date] <= COALESCE ( MAXX ( Rent, Rent[End Date] ), _BlankDate )
        ),
        Dates[Year Month],
        Dates[Year]
    )
RETURN
    SUMX ( _ValidDates, SUM ( Rent[Customer Rent] ) )
Total Rent = 
SUMX ( VALUES ( Rent[Customer] ), [Rent] )

danextian_1-1741263568940.png

Please see the attached sample pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
johnt75
Super User
Super User

You could create a measure like

Rent = 
VAR MinDate = MIN( 'Date'[Date] )
VAR MaxDate = MIN( MAX( 'Date'[Date] ), EOMONTH( TODAY(), -1 ) )
VAR SummaryTable = GENERATE(
	SELECTCOLUMNS(
		Rent,
		Rent[Customer],
		Rent[Customer Rent],
		"@StartDate", Rent[Start Date],
		"@EndDate", COALESCE( Rent[End Date], MaxDate )
	),
	FILTER(
		DATESBETWEEN( 'Date'[Date], [@StartDate], [@EndDate] ),
		DAY( 'Date'[Date] ) = DAY( [@StartDate] )
	)
)
RETURN SUMX( 
	FILTER(
		SummaryTable, 
		'Date'[Date] >= MinDate && 'Date'[Date] <= MaxDate
	),
	Rent[Customer Rent] 
)

For each customer it generates a list of dates when the rent would be due, and then sums all those rents which are due during the selected period.

FarhanJeelani
Super User
Super User

To calculate the rent progression over time in Power BI, follow these steps:

 

Step 1: Create a Date Table
Since you need a continuous timeline, create a Date table:

DateTable = ADDCOLUMNS(
CALENDAR(DATE(2021,1,1), DATE(2025,12,31)),
"Year", YEAR([Date]),
"Month", FORMAT([Date], "YYYY-MM")
)


Step 2: Expand Rent Periods for Each Month
Since each rent period has a start and (possibly) an end date, we need to generate a table that expands rent data for each month.

Use Power Query to create a new table:

Expand rental periods: Create a list of months between [Start Date] and [End Date] (or today if no end date).
Expand rows: Each row represents rent applied to that specific month.


Or, in DAX, create a new table:

RentExpanded =
VAR MaxDate = TODAY()
RETURN
ADDCOLUMNS(
FILTER(
CROSSJOIN('DateTable', RentTable),
RentTable[Start Date] <= DateTable[Date] &&
(ISBLANK(RentTable[End Date]) || RentTable[End Date] >= DateTable[Date])
),
"Monthly Rent", RentTable[Customer Rent]
)


Step 3: Calculate Monthly and Yearly Rent
Create measures:

Monthly Rent Calculation

Total Monthly Rent =
SUMX(
RentExpanded,
RentExpanded[Monthly Rent]
)


Yearly Rent Calculation

Total Yearly Rent =
CALCULATE(
[Total Monthly Rent],
ALLEXCEPT('DateTable', 'DateTable'[Year])
)


Step 4: Create Visuals
Monthly Rent Chart:

X-Axis: DateTable[Month]
Y-Axis: Total Monthly Rent
Yearly Rent Chart:

X-Axis: DateTable[Year]
Y-Axis: Total Yearly Rent

 

Please mark this post as solution if it helps you. Appreciate Kudos.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.