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
yikl
New Member

Using DAX and parameter to calculate leasing contract start and end date

Hi all

 

I am new to DAX and wonder if this is something doable using DAX.  I have a schedule containing leasing contract and the monthly rental.  There are 2 types of contracts - contract type F is fixed which the start and end date are confirmed with tenant while contract type D hasn't been confirmed and can change subject to market condition.  Below is a sample schedule:

 

rowdateunitcontract_typecontract_start_datecontract_end_daterent  
11/1/2023AF1/1/20224/30/2023100  
22/1/2023AF1/1/20224/30/2023100  
33/1/2023

A

F1/1/20224/30/2023100  
44/1/2023AF1/1/20224/30/2023100  
55/1/2023AD5/20/20238/19/2023200  
66/1/2023AD5/20/20238/19/2023200  
77/1/2023AD5/20/20238/19/2023200  
88/1/2023AD5/20/20238/19/2023200  
99/1/2023AD9/8/202312/7/2023250  
1010/1/2023AD9/8/202312/7/2023250  

 

Row 1 - 4 has a fixed contract and therefore start and end date has been confirmed and can't be changed.

Row 5 - contract is not fixed yet.  Its start date is 20 days after the last contract ends.  Duration of contract is 3 months and hence end date is mid Aug.

Row 9 - last contract ends on Aug 19.  Its start date is 20 days after the last contract and therefore Sep 8, and end date is 3 months later - Dec 7.

 

I want to have the flexibility to use parameter to simulate the different number of days in between contract.  Instead of 20 days I now change to 25 days with contract duration still remains at 3 months.  Would it be possible to use DAX to create the new start and end date?  Such parameter should only apply to contract_type as "D"

 

rowdateunitcontract_typecontract_start_datecontract_end_daterentnew_start_datenew_end_date
11/1/2023AF1/1/20224/30/20231001/1/20224/30/2023
22/1/2023AF1/1/20224/30/20231001/1/20224/30/2023
33/1/2023AF1/1/20224/30/20231001/1/20224/30/2023
44/1/2023AF1/1/20224/30/20231001/1/20224/30/2023
55/1/2023AD5/20/20238/19/20232005/25/20238/24/2023
66/1/2023AD5/20/20238/19/20232005/25/20238/24/2023
77/1/2023AD5/20/20238/19/20232005/25/20238/24/2023
88/1/2023AD5/20/20238/19/20232005/25/20238/24/2023
99/1/2023AD9/8/202312/7/20232509/18/2023

12/17/2023

1010/1/2023AD9/8/202312/7/20232509/18/2023

12/17/2023

 

Row 5 - start date is now May 25, with a 3 months duration, end date is pushed to Aug 24.  Subsequently on row 9, the start and end date is moved due to the last contract end date.

 

It'd be great if the experts here can shed some lights on how this can be done in DAX.

 

Thanks.

 

yikl

 

 

1 REPLY 1
SivaMani
Resident Rockstar
Resident Rockstar

@yikl, Try What-If Parameter. Refer the below URL for more details
https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-what-if

 

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.

Top Solution Authors