Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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...
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
27 | |
13 | |
13 | |
10 | |
6 |