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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Ros_Al
Regular Visitor

Dashboard on Revenue by Rental Agreement

Hi 

I'm new to Power Bi, may I know what kind of tables must I have to calculate the revenue by year.

 

Do I need the calendar columns, Customer Table, Sales table (rental amount), Contract ID table?

How do I calculate the revenue by year?

 

CustomerContract StartContract EndRental Per Month
Cus A01/10/201730/09/20193500
Cus A01/10/201930/09/20223800
Cus A01/10/202230/09/20244200
Cus B01/01/202031/12/2020270
Cus B01/01/202131/12/2022270
Cus C01/10/201931/03/20202800
Cus D15/04/201714/04/20191200
Cus D15/04/201914/04/20211400
Cus D15/04/202114/04/20231300
Cus E01/12/201930/11/2020650
Cus E01/12/202030/11/2021400
Cus F01/01/202031/12/2020700
Cus F01/01/202131/12/2021750
Cus G01/10/202030/09/2021400
Cus G01/10/202130/09/2022450

 

 

1 ACCEPTED SOLUTION
v-yetao1-msft
Community Support
Community Support

Hi @Ros_Al 

For the twelve months from [Contract Start] , you can create your own date table and calculate the annual rent separately .

Create a calculated table .

 

date = GENERATE( SUMMARIZE( ADDCOLUMNS( CALENDAR(MIN('Table'[Contract Start]),MAX('Table'[Contract End])),"year",YEAR([Date])),[year]),VALUES('Table'[Customer]))

 

Then create a measure to return the revenue by year .

 

Measure = 
// CALCULATE(SUM('Table'[Rental Per Month]),
// FILTER('Table',YEAR([Contract Start])<=MAX('date'[year])&&YEAR([Contract End])>=MAX('date'[year])&&[Customer]=MAX('date'[Customer])))
var _startmonth=CALCULATE(MONTH(MAX('Table'[Contract Start])),FILTER('Table',[Customer]=MAX('date'[Customer])))
return IF(_startmonth=1,
CALCULATE(SUM('Table'[Rental Per Month])*12,FILTER('Table',[Customer]=MAX('date'[Customer])&&YEAR([Contract Start])<=MAX('date'[year])&&YEAR([Contract End])>=MAX('date'[year]))),
CALCULATE(SUM('Table'[Rental Per Month])*12,FILTER('Table',[Customer]=MAX('date'[Customer])&&YEAR([Contract Start])<=MAX('date'[year])&&YEAR([Contract End])-1>=MAX('date'[year]))))

 

 You will get a result like this :

Ailsamsft_0-1667984428224.png

Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yetao1-msft
Community Support
Community Support

Hi @Ros_Al 

For the twelve months from [Contract Start] , you can create your own date table and calculate the annual rent separately .

Create a calculated table .

 

date = GENERATE( SUMMARIZE( ADDCOLUMNS( CALENDAR(MIN('Table'[Contract Start]),MAX('Table'[Contract End])),"year",YEAR([Date])),[year]),VALUES('Table'[Customer]))

 

Then create a measure to return the revenue by year .

 

Measure = 
// CALCULATE(SUM('Table'[Rental Per Month]),
// FILTER('Table',YEAR([Contract Start])<=MAX('date'[year])&&YEAR([Contract End])>=MAX('date'[year])&&[Customer]=MAX('date'[Customer])))
var _startmonth=CALCULATE(MONTH(MAX('Table'[Contract Start])),FILTER('Table',[Customer]=MAX('date'[Customer])))
return IF(_startmonth=1,
CALCULATE(SUM('Table'[Rental Per Month])*12,FILTER('Table',[Customer]=MAX('date'[Customer])&&YEAR([Contract Start])<=MAX('date'[year])&&YEAR([Contract End])>=MAX('date'[year]))),
CALCULATE(SUM('Table'[Rental Per Month])*12,FILTER('Table',[Customer]=MAX('date'[Customer])&&YEAR([Contract Start])<=MAX('date'[year])&&YEAR([Contract End])-1>=MAX('date'[year]))))

 

 You will get a result like this :

Ailsamsft_0-1667984428224.png

Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

daXtreme
Solution Sage
Solution Sage

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.