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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Waxy
Frequent Visitor

Determine available contracts

Hello

 

I have a Contract Assets table that the following  columns ;

  • Contract_ID
  • AssetName 
  • StartDate_Copy - Contract's start date
  • EndDate_Copy - Contract's end date

I also have a Dates, date table.

 

In PBI Desktop, I want to have a data slicer to obtain the start and end dates in question, from these inputs, I would like the table displaying the above fields, plus a field denoting "Available" or "UnAvailable". 

I'm attempting to create a measure that will contain the availability.

 

Below,  is the code that I am working with... I am really new to Power BI and Dax. I was thinking I could add the Available Measure to the table visual. I keep hitting blocks with the below syntax. I was having a challenge with the brackets...

 

Available Measure =
Var MinValue = Min(Dates[Date])
Var MaxValue = Max(Dates[Date])
Var ContractStart = SUM(ContractAssets[StartDate_Copy])
Var ContractEnd = Sum(ContractAssets[EndDate_Copy])

Return
if((ContractStart >= MinValue) and (ContractStart <= MaxValue)) or
(ContractEnd >= MinValue and ContractEnd <= MaxValue) or (ContractStart <= MinValue and ContractEnd >= MaxValue),'Available', 'Not Available')
3 REPLIES 3
Anonymous
Not applicable

Hi  @Waxy  ,

You can change the formula to try like this:

Available Measure =
Var MinValue = Min(Dates[Date])
Var MaxValue = Max(Dates[Date])
Var ContractStart = SUM(ContractAssets[StartDate_Copy])
Var ContractEnd = Sum(ContractAssets[EndDate_Copy])
Return
switch(
       true(),
       (ContractStart >= MinValue) and (ContractStart <= MaxValue),'Available',
       (ContractEnd >= MinValue) and (ContractEnd <= MaxValue),'Available',
       (ContractStart <= MinValue) and (ContractEnd >= MaxValue),'Available',
       'Not Available'
)

 

If my answer is not what you need, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@Waxy not sure if it is a typo or you are actually using SUM, it should be MIN or MAX

 

Var ContractStart = SUM(ContractAssets[StartDate_Copy])
Var ContractEnd = Sum(ContractAssets[EndDate_Copy])


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Waxy
Frequent Visitor

Was having so much grief with this, starting to get confused how to reference a column in a table. StartDate_Copy and EndDate_Copy are the actual columns in the dataset table. Wasn't having much luck so tried to use variables to capture each row. Guess I'm off track?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors