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

To find out expired row item that the date will be expired in the next determine month

Hello everyone, may I know how can I code if I wanted to find out what are the number of unique row that their date will be expired in the next determine month (based on todays date) ? For example, the picture below show that C00003 will be expired within the next 6 month based on todays date, however, C00001 is not. So the result will be one out of 2 will be expired. 

 

Screenshot 2022-05-16 110917.png

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Column:

Expires next month = 
var _date = DATE(Year(today()),Month(today())+2,1)-1
Return
Switch(True(),
[Contact Expiry Date]<=_date &&[Contact Expiry Date]>= today(), "Yes",
[Contact Expiry Date]> _date ,"No")
Count = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Contract Number] ),
    FILTER ( 'Table', [Expires next month] = "Yes" )
)

vzhangti_0-1652853110122.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Column:

Expires next month = 
var _date = DATE(Year(today()),Month(today())+2,1)-1
Return
Switch(True(),
[Contact Expiry Date]<=_date &&[Contact Expiry Date]>= today(), "Yes",
[Contact Expiry Date]> _date ,"No")
Count = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Contract Number] ),
    FILTER ( 'Table', [Expires next month] = "Yes" )
)

vzhangti_0-1652853110122.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Anonymous
Not applicable

Yes !! thank you so much for helping out 😁 really appreciate that !!

amitchandak
Super User
Super User

@Anonymous , New column

Expire in next sxi month

var _date = date(year(today()), month(today())+6 , day(today())

return

Switch(True(),

[Contract Expiry Date] < _date && [Contract Expiry Date] >= today(), "With in 6 month"

[Contract Expiry Date] >= _date && , "After 6 Month")

Anonymous
Not applicable

Hi, thanks for your help, but not sure why it is not working 

 

Screenshot 2022-05-16 203002.png

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