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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
AnnaShenHO
Frequent Visitor

Contract ending next 6 months and 12 months and beyond

Contract titleContract End DateContracts Ending in 6 or 12 mths
A1st Dec 2024Contract Ending in 6 mths
B2st Jan 2025Contract Ending in 6 mths
C1st June 2025Contract Ending in 12 mths
D31st Dec 2025Contract Ending Beyong 12 mths

 

Dear team, I have existing 2 columns (Contract Title and End Date). I'm trying to add a new columns, similiar like

"Contracts ending in 6 or 12 mths", each if [End Date] <= today's date + 6 months then "Contracts ending in 6 mths" else if [End Date] <= today's date + 12 months then "Contracts ending in 12 mths" else "Contracts ending after 12 mths").

I just dont know how to write dax about above underlines part. Grateful for your advise. 

Anna

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

Hi @AnnaShenHO ,

 

Your solution is great, DataInsights . It worked like a charm! Here I have another idea in mind, and I would like to share it for reference. 

 

You can try the following calculated column.

Contracts Ending in 6 or 12 mths = 
VAR _today = TODAY()
VAR _diff = DATEDIFF(_today,'Table'[Contract End Date],MONTH)
RETURN
SWITCH(TRUE(),
_diff <= 6, "Contract Ending in 6 mths",
_diff <= 12, "Contract Ending in 12 mths",
"Contract Ending Beyong 12 mths")

vkaiyuemsft_0-1733189851549.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any 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-kaiyue-msft
Community Support
Community Support

Hi @AnnaShenHO ,

 

Your solution is great, DataInsights . It worked like a charm! Here I have another idea in mind, and I would like to share it for reference. 

 

You can try the following calculated column.

Contracts Ending in 6 or 12 mths = 
VAR _today = TODAY()
VAR _diff = DATEDIFF(_today,'Table'[Contract End Date],MONTH)
RETURN
SWITCH(TRUE(),
_diff <= 6, "Contract Ending in 6 mths",
_diff <= 12, "Contract Ending in 12 mths",
"Contract Ending Beyong 12 mths")

vkaiyuemsft_0-1733189851549.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

DataInsights
Super User
Super User

@AnnaShenHO,

 

Try this calculated column:

 

Contracts Ending in 6 or 12 mths = 
VAR vToday =
    TODAY ()
VAR vContractEndDate = 'Table'[Contract End Date]
VAR vResult =
    SWITCH (
        TRUE,
        vContractEndDate <= EDATE ( vToday, 6 ), "Contracts Ending in 6 mths",
        vContractEndDate <= EDATE ( vToday, 12 ), "Contracts Ending in 12 mths",
        "Contracts Ending Beyond 12 mths"
    )
RETURN
    vResult

 

DataInsights_0-1733177081916.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors