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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
alex9999
Helper I
Helper I

Create graph that includes all dates between a start and end date

Hi,

 

I want to create a graph where my X axis has months of the year and my Y axis has count of items. The idea is to have the graph include all the months that the item has been hired, which is identified between a start and an end date.

 

For example, if an item has been on-hired January 2024 and off-hired March 2024, the graph will count 1 for January, February and March.

 

I have the idea in my head but I am struggling to execute. My data has [item], [start_date] and [end_date].

 

Thank you.

2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@alex9999 

try to create a date table

 

date = CALENDAR(min('Table'[Startdate]),max('Table'[enddate]))
 
then create a measure
Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Startdate]<=min('date'[Date])&&'Table'[enddate]>=max('date'[Date])))
 
11.PNG
 
pls see the attachment below




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

AnalyticPulse
Super User
Super User

hi @alex9999 You can try below dax and let me know if it works
Items Count =
VAR MinDate = MIN('OnboardOffboardTable'[start_date])
VAR MaxDate = MAX('OnboardOffboardTable'[end_date])
VAR CalendarTable = CALENDAR(MIN(MinDate), MAX(MaxDate))
RETURN
SUMX(
CalendarTable,
CALCULATE(
COUNTROWS('OnboardOffboardTable'),
'OnboardOffboardTable'[start_date] <= CalendarTable[Date] &&
'OnboardOffboardTable'[end_date] >= CalendarTable[Date]
)
)

Learn Power BI free:

https://analyticpulse.blogspot.com

Power BI : getting started

Dax functions

powerbi Visualisation

AnalyticPulse_0-1715829624787.png

 

 

View solution in original post

4 REPLIES 4
AnalyticPulse
Super User
Super User

hi @alex9999 You can try below dax and let me know if it works
Items Count =
VAR MinDate = MIN('OnboardOffboardTable'[start_date])
VAR MaxDate = MAX('OnboardOffboardTable'[end_date])
VAR CalendarTable = CALENDAR(MIN(MinDate), MAX(MaxDate))
RETURN
SUMX(
CalendarTable,
CALCULATE(
COUNTROWS('OnboardOffboardTable'),
'OnboardOffboardTable'[start_date] <= CalendarTable[Date] &&
'OnboardOffboardTable'[end_date] >= CalendarTable[Date]
)
)

Learn Power BI free:

https://analyticpulse.blogspot.com

Power BI : getting started

Dax functions

powerbi Visualisation

AnalyticPulse_0-1715829624787.png

 

 

ryan_mayu
Super User
Super User

@alex9999 

try to create a date table

 

date = CALENDAR(min('Table'[Startdate]),max('Table'[enddate]))
 
then create a measure
Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Startdate]<=min('date'[Date])&&'Table'[enddate]>=max('date'[Date])))
 
11.PNG
 
pls see the attachment below




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Perfect solution. I did attempt with other forum posts but this one made it very clear to me. Thank you!

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Kudoed Authors