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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
REL
New Member

Number of days w/i qtrs for a period of time

I have a table of events with a start date and end date for each event. The start end and dates don't necessarily coincide with the start or end of months,quarters or years. I need to create a report with the event and the number of days, by year/qtr for the period of the event. I can use DateDiff to get the totals number of days or quarters between the start and end dates, but havent seen how to get the number of days, by qtr for the start to end date of the event.

 

Bob

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You can get the number of days in a period by creating a new measure

Event days =
VAR StartDate =
    SELECTEDVALUE ( 'Events'[Start Date] )
VAR EndDate =
    SELECTEDVALUE ( 'Events'[End Date] )
VAR Result =
    CALCULATE (
        COUNTROWS ( 'Date' ),
        KEEPFILTERS ( DATESBETWEEN ( 'Date'[Date], StartDate, EndDate ) )
    )
RETURN
    Result

Put that in a matrix with your events and any column from the date table.

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

You can get the number of days in a period by creating a new measure

Event days =
VAR StartDate =
    SELECTEDVALUE ( 'Events'[Start Date] )
VAR EndDate =
    SELECTEDVALUE ( 'Events'[End Date] )
VAR Result =
    CALCULATE (
        COUNTROWS ( 'Date' ),
        KEEPFILTERS ( DATESBETWEEN ( 'Date'[Date], StartDate, EndDate ) )
    )
RETURN
    Result

Put that in a matrix with your events and any column from the date table.

That did it. Thanks

lbendlin
Super User
Super User

You use INTERSECT() for that.

 

If you like more help please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
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.