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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Live now!

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

Hi @Anonymous ,

 

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
Anonymous
Not applicable

Hi @Anonymous ,

 

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

@Anonymous,

 

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.