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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Get the count between two date columns

I'm having a hard time wrapping my head around this.

 

Each row has two date columns (start date and end date). If one row has a date starting 1/1/2023 and end date of 5/1/2023 then the time period between the two dates is when it was considered active and I'd like to tally a "1". If it has a start date but no end date, that's also a tally for "1".

 

So what I ultimately want to see in the bar (or line) graph, using the start and end date above, is that if I'm looking at the month of Jan, Feb, Mar, Apr then it should show me the count of "1". If it had a start date of 1/1/2023 and no end date, and I was looking at the graph in Dec then it should also count as 1 and it should count as 1 for all the months before up till the start date.

 

Can't figure out how to do this.

3 REPLIES 3
poweringthru
Helper I
Helper I

Try this measure (assumes you have 'Calendar' table with a 'Calendar'[Date] column, and your matrix column or your line chart x-axis is this Calendar column).

Also, SELECTEDVALUE needs that each row in your table can have only one startingdate value and only one endingdate value.

 

Is Active Measure =

VAR Max_Date =
MAX('Calendar'[Date])

VAR Min_Date =
MIN('Calendar'[Date])

VAR Check_Value =
IF(
    SELECTEDVALUE('Table1'[startingdate])<=Max_Date
    && (SELECTEDVALUE('Table1'[endingdate])>=Min_Date || ISBLANK(SELECTEDVALUE('Table1'[endingdate]))),
    1,
    0
)

RETURN
Check_Value

 

 

Anonymous
Not applicable

I do have a start and end date columns and a date table. I applied what you showed but when inserted into the line graph, I get a single line with the value of 1.

Make sure to add your Table1 rows as legends in the chart (that way it will show a different color line for each one).

Also, try it on a matrix (Table1 x Calendar and this measure as Value) and you'll see it calculates the 1 and 0 as expected).

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Kudoed Authors