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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
RichOB
Post Partisan
Post Partisan

Measure for values in a date range

Hi, I have a table below that shows the number of instances that happened on a specific date in the next row. I need 2 measures that show:

 

2023 - 4798 instances

2024 - 3555 instances

 

InstancesDate
115710/04/2023
152710/07/2023
115710/10/2023
95710/01/2023
112610/04/2023
116310/07/2023
106610/10/2023

 

How can this be done please?

3 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@RichOB , Try using 

 

Instances_2023 =
CALCULATE(
SUM('Table'[Instances]),
YEAR('Table'[Date]) = 2023
)

 

Instances_2024 =
CALCULATE(
SUM('Table'[Instances]),
YEAR('Table'[Date]) = 2024
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

@RichOB , Try using 

 

2023_Instances =
CALCULATE(
COUNT('Table'[Instances]),
FILTER(
'Table',
'Table'[Date] >= DATE(2023, 1, 4) && 'Table'[Date] <= DATE(2023, 3, 31)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

Anonymous
Not applicable

Hi @RichOB 

 

Thank you very much bhanu_gautam for your prompt reply.

 

I tested your measure and bhanu_gautam's measure separately and both give correct results. If your code does not work, check that the data type of the date is correct.

 

vnuocmsft_0-1737686590827.png

 

If there are any potential filters applied to your report that may also affect the calculation. You may consider using the ALL function to ignore these filters.

 

Filter ALL 2023_Instances = 
CALCULATE(
COUNT('Table'[Instances]),
FILTER(
ALL('Table'),
'Table'[Date] >= DATE(2023, 1, 4) && 'Table'[Date] <= DATE(2024, 3, 31)
)
)

 

Regards,

Nono Chen

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

Hi @RichOB 

 

Thank you very much bhanu_gautam for your prompt reply.

 

I tested your measure and bhanu_gautam's measure separately and both give correct results. If your code does not work, check that the data type of the date is correct.

 

vnuocmsft_0-1737686590827.png

 

If there are any potential filters applied to your report that may also affect the calculation. You may consider using the ALL function to ignore these filters.

 

Filter ALL 2023_Instances = 
CALCULATE(
COUNT('Table'[Instances]),
FILTER(
ALL('Table'),
'Table'[Date] >= DATE(2023, 1, 4) && 'Table'[Date] <= DATE(2024, 3, 31)
)
)

 

Regards,

Nono Chen

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

bhanu_gautam
Super User
Super User

@RichOB , Try using 

 

Instances_2023 =
CALCULATE(
SUM('Table'[Instances]),
YEAR('Table'[Date]) = 2023
)

 

Instances_2024 =
CALCULATE(
SUM('Table'[Instances]),
YEAR('Table'[Date]) = 2024
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi @bhanu_gautam Thanks for this.

 

How would I get the count of instances between 1/4/2023 - 3/31/2024?
Usually I would do this measure like below, but it's not working:

2023_Instances = (
    CALCULATE(
        COUNT('Table' [Instances]),
        'Table'[Date]>=DATE(2023,4,1),
        'Table'[Date]<=DATE(2024,3,31)
    ))
 
Thanks

@RichOB , Try using 

 

2023_Instances =
CALCULATE(
COUNT('Table'[Instances]),
FILTER(
'Table',
'Table'[Date] >= DATE(2023, 1, 4) && 'Table'[Date] <= DATE(2023, 3, 31)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors