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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
s--turn
Helper II
Helper II

Identifying which year-ends (Dec 31st) are between two dates

Hello,

 

I need to be able to produce counts for the total number of subscriptions that were active as of December 31st each year.  This is the kind of raw data I have:

 

Subscription IDValid FromValid To
123-XYZ01/01/202131/12/2021
456-ABC04/10/202031/12/2021

 

If they were all complete years like the top row, I would just use the Valid To date.  However, records like the bottom row needs to be identified as active on both 31st December 2020 and 2021. 

 

I ultimately want to be able to get something like this:

Year-EndCount of Subscriptions
20201
20212

 

Any ideas?

 

Many thanks!

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

Hi @s--turn ,

 

You can try this measure.

 

Count of Subscriptions =
CALCULATE (
    COUNT ( 'Table'[Subscription ID] ),
    FILTER (
        'Table',
        'Table'[Valid From] <= MAX ( 'Calendar'[Date] )
            && 'Table'[Valid To] >= MAX ( 'Calendar'[Date] )
    )
)

 

Result is as below.

RicoZhou_1-1666852801416.png

 

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
s--turn
Helper II
Helper II

Thank you, @v-rzhou-msft ! Much appreciated.

v-rzhou-msft
Community Support
Community Support

Hi @s--turn ,

 

You can try this measure.

 

Count of Subscriptions =
CALCULATE (
    COUNT ( 'Table'[Subscription ID] ),
    FILTER (
        'Table',
        'Table'[Valid From] <= MAX ( 'Calendar'[Date] )
            && 'Table'[Valid To] >= MAX ( 'Calendar'[Date] )
    )
)

 

Result is as below.

RicoZhou_1-1666852801416.png

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.