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.
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.
Registration | Contract Start | Contract End | Monthly Lease Value |
123ABC | 01/01/2020 | 31/12/2021 | 1380.96 |
456DEF | 01/03/2020 | 30/06/2022 | 1150.50 |
789HIJ | 01/01/2020 | 31/12/2020 | 986.80 |
012KLM | 20/02/2020 | 30/06/2022 | 1874.80 |
345NOP | 31/12/2018 | 29/02/2020 | 1008.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
Date | Total Monthly Lease Cost |
Jan-20 | 3375.86 |
Feb-20 | 5250.66 |
Mar-20 | 5393.06 |
Apr-20 | 5393.06 |
May-20 | 5393.06 |
Jun-20 | 5393.06 |
Jul-20 | 5393.06 |
Aug-20 | 5393.06 |
Sep-20 | 5393.06 |
Oct-20 | 5393.06 |
Nov-20 | 5393.06 |
Dec-20 | 4406.26 |
Solved! Go to Solution.
@StidifordN , refer if this blog on expanding start date and end date can help you
@StidifordN , refer if this blog on expanding start date and end date can help you
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]))
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
65 | |
60 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |