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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
shaunguyver
Helper III
Helper III

Count instances occurring between fixed date and today

I have a table, 'Risks'.

 

In this table I have a column, 'Date', which gives a range of dates across 2018.

 

I also have a second column, 'Type', which gives the type of event associated with that date. The values are either 'Open' or 'Closed'.

 

I want to create a measure that calculates how many 'Open' events occured since a fixed date '01/01/2018' and Today.

 

I have tried to create this measure but have had no luck. Does anyone have any ideas?

 

Thanks

1 ACCEPTED SOLUTION
Christann
Helper IV
Helper IV

Try something like this:

OpenEvents =
CALCULATE (
    COUNTA ( Table1[Type] ),
    Table1[Date] >= DATE ( 2018, 1, 1 ),
    Table1[Date] <= TODAY (),
    Table1[Type] = "Open"
)

 

View solution in original post

3 REPLIES 3
ChandeepChhabra
Impactful Individual
Impactful Individual

@shaunguyver - Hi 

 

Please create a Calendar Table and relate it to your Risks Table

Then try this measure

 

Instances =
CALCULATE (
COUNT ( Risks[Date] ),
DATESBETWEEN ( Calendar[Date], DATE ( 2018, 1, 1 ), TODAY () ),
Risks[Type] = "Open"
)

 

If you would like to have a unique count of the date then replace the COUNT with DISTINCTCOUNT

 

Hope this helps

Christann
Helper IV
Helper IV

Try something like this:

OpenEvents =
CALCULATE (
    COUNTA ( Table1[Type] ),
    Table1[Date] >= DATE ( 2018, 1, 1 ),
    Table1[Date] <= TODAY (),
    Table1[Type] = "Open"
)

 

rafaelmpsantos
Responsive Resident
Responsive Resident

Hi lets try.

MEASURE = 
calculate(count(Table[Type]),datesbetween(table[Date],01/01/2018,today())

 

If it solve please mark as solved and give me your positive feed back.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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