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
beginner_user08
Regular Visitor

Calcualate 3months/6months/12months out using Expiration Date

Hello PowerBi Experts,

 

Could some please help with the PBI Query.

 

In my table, I have expiration date column and I wanted to know which among my records  are expiring in the next 3/6/12 months. My  Today's date here is 3/22/2023. Below is my criteria for the bucket of months. if contract is expiring in 0-90 days from today's date, then that is <3months; if 91-180 days, 6months, if 181-365, that is 12 months. Anything exceeding 12 months, will be ">12 months". Else (for contracts expiring before today's date, it would be "out of range").

how do i create this formula in Power BI. 

 

Record IDExpiration DateDatedif from TodayComment
112/21/2022-91Out of Range
204/21/202330<3months
305/06/202345<3months
405/16/202355<3months
506/20/202390<6months
606/30/2023100<6months
709/23/2023185<12months
810/08/2023200<12months

 

My formula below is actually looking for past expiring dates and not future dates, so I cannot predict the accurate no of records expiring soon.

 

Expire Aging Bucket =
IF(AND(DATEDIFF('CLM Report'[Expires].[Date],TODAY(),DAY)>= 0,
DATEDIFF('CLM Report'[Expires].[Date],TODAY(),DAY)<=90), "3 Months",

IF(AND(DATEDIFF('CLM Report'[Expires].[Date],TODAY(),DAY)>90,
DATEDIFF('CLM Report'[Expires].[Date],TODAY(),DAY)<=180), "6 Months",

IF(AND(DATEDIFF('CLM Report'[Expires].[Date],TODAY(),DAY)>180,
DATEDIFF('CLM Report'[Expires].[Date],TODAY(),DAY)<=365), "12 Months",
"Outside of the Range")
))
 
 Below is the resulf of above formula and this is not correct since the 7 count is expiring in 2022, not 2023 (future dates).
beginner_user08_0-1679510014518.png

 

Could you help please.
1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @beginner_user08 ,

I hvae created a simple sample, please refer to my pbix file to see if it helps you.

vrongtiepmsft_0-1679626623510.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

View solution in original post

1 REPLY 1
v-rongtiep-msft
Community Support
Community Support

Hi @beginner_user08 ,

I hvae created a simple sample, please refer to my pbix file to see if it helps you.

vrongtiepmsft_0-1679626623510.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

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.