Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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
Solved! Go to Solution.
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.
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
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...
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
19 | |
14 | |
10 | |
10 | |
9 |
User | Count |
---|---|
15 | |
13 | |
12 | |
12 | |
11 |