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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
StidifordN
Helper III
Helper III

Calcualted table, monthly based on List of Vehicles Start/End dates

howdy, 

 

Not sure where to start on this one.

I have a table of vehicles in our fleet; with Contract Start Date, Contract End Date and a monthly lease value.  Example below.

 

RegistrationContract StartContract EndMonthly Lease Value
123ABC01/01/202031/12/20211380.96
456DEF01/03/202030/06/20221150.50
789HIJ01/01/202031/12/2020986.80
012KLM20/02/202030/06/2022

1874.80

345NOP31/12/201829/02/20201008.10

 

I'd like to create a table (end goal being a column chart or line graph) listing out the calculated total lease cost per month, for vehicles that have a valid contract within the months based on start and end dates.  
In regards to a vehicle that starts or ends mid month - i'm happy to calulate that if valid for any day in a month, that whole monthly least cost can be calculated in (unless its simple to do a over-half calc).

My goal

DateTotal Monthly Lease Cost
Jan-20

3375.86

Feb-205250.66
Mar-20

5393.06

Apr-205393.06
May-205393.06

Jun-20

5393.06
Jul-205393.06
Aug-205393.06

Sep-20

5393.06
Oct-205393.06
Nov-205393.06
Dec-204406.26

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User
2 REPLIES 2
amitchandak
Super User
Super User

Perfect.

I sorted this out with both a count and sum of the assets.

CurrentContractSpend = 
CALCULATE(SUMX(FILTER(FleetPortfolio,FleetPortfolio[CONTRACTSTARTDATE]<=MAX(Dates[Date]) && FleetPortfolio[ContractEndDate_Final]>MAX(Dates[Date])),FleetPortfolio[LEASERENTAL]))

CurrentContractCount = 
CALCULATE(COUNTX(FILTER(FleetPortfolio,FleetPortfolio[CONTRACTSTARTDATE]<=MAX(Dates[Date]) && FleetPortfolio[ContractEndDate_Final]>MAX(Dates[Date])),FleetPortfolio[CONTRACTID]))

 

312123.JPG

 

I followed the instructions to the point of inactive relationship of the specific date fields to the date table also.

Much appreciated for the very quick response @amitchandak 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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