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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
RichOB
Post Partisan
Post Partisan

Day Count Measure

Hi, using the table below, I need the number of days that each Room was empty per month, please:

 

LocationRoomEmpty_Start_DateEmpty_End_DateDays_Empty
EdinburghE101/04/202424/04/202424
EdinburghE201/04/202431/05/202460
GlasgowG101/04/202430/07/2024120
GlasgowG201/04/202401/06/202461


This is the end result I'm looking for :

RoomAprilMayJuneJuly
E124   
E23031  
G1303130 
G23031130
 114933130

**my monthly numbers may be a tad wrong here.

 

Thanks

1 ACCEPTED SOLUTION

If your DaysOpen measure is showing blank in a card, it might be because there's no row context — try wrapping it like this:

DaysOpen = 
CALCULATE(
    DATEDIFF(MIN('Table'[Start_Date]), TODAY(), DAY)
)

Now for the line graph part — if you want to show how many items are still open per month, you’ll need to:

  1. Create a Calendar table with a full date range.
  2. Create a relationship from Calendar[Date] to Table[Start_Date].
  3. Use a measure like this:
OpenItems = 
CALCULATE(
    COUNTROWS('Table'),
    'Table'[Start_Date] <= MAX('Calendar'[Date])
)

This will count how many items were open as of each date in the calendar, and you can plot that over time.

Let me know if you want to include End_Date logic too (like only count items that haven’t been closed yet).
translation and formatting supported by AI

View solution in original post

5 REPLIES 5
burakkaragoz
Super User
Super User

Hi @RichOB ,

 

You can create a measure like this to count the number of days between two dates:

DayCount = DATEDIFF(MIN('Table'[StartDate]), MAX('Table'[EndDate]), DAY)

If you're working with filters or slicers, make sure the context is right — sometimes wrapping it in a CALCULATE or using SELECTEDVALUE helps depending on your setup.

Let me know if you’re trying to count working days or exclude weekends/holidays — that’s a slightly different approach.


If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI

Hi @burakkaragoz thanks for getting back to me, this is great thank you! How would the measure change if there is no end date and I want the current Today's date as the MAX date please?

Hi @RichOB ,

 

If you want the day count just for the selected row (not across the whole table), you can use something like this:

DayCount = 
DATEDIFF(
    SELECTEDVALUE('Table'[StartDate]),
    SELECTEDVALUE('Table'[EndDate]),
    DAY
)

This way, it only calculates the difference for the current row in the visual. If you're using it in a card or matrix, it should now behave as expected.

Let me know if you're working with multiple rows or need to handle blanks — happy to tweak it further!
translation and formatting supported by AI

I'm not sure this is what I'm looking for (maybe it is and I don't understand it! sorry haha). For some reason, this is showing as blank on a card. I have the running total now from this measure:

DaysOpen = DateDiff ('Table'[Start_Date], TODAY (), DAY)

How could I connect this to a line graph? When I try to join the calendar to the Table it asks to join to the Table Start_Date or End_Date but I don't want that as it would give incorrect figures. How do I structure hte calendar to show the correct days open total per month? 

If your DaysOpen measure is showing blank in a card, it might be because there's no row context — try wrapping it like this:

DaysOpen = 
CALCULATE(
    DATEDIFF(MIN('Table'[Start_Date]), TODAY(), DAY)
)

Now for the line graph part — if you want to show how many items are still open per month, you’ll need to:

  1. Create a Calendar table with a full date range.
  2. Create a relationship from Calendar[Date] to Table[Start_Date].
  3. Use a measure like this:
OpenItems = 
CALCULATE(
    COUNTROWS('Table'),
    'Table'[Start_Date] <= MAX('Calendar'[Date])
)

This will count how many items were open as of each date in the calendar, and you can plot that over time.

Let me know if you want to include End_Date logic too (like only count items that haven’t been closed yet).
translation and formatting supported by AI

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.