Forum Discussion
how to get context boundaries
Hello everyone!
How to get date borders by which data is grouped in context?
I have a date type field, and two groups (by month and week). The report has a drilldown set up: I can see data by month or week.
I want to calculate the SLA value depending on the number of days that fall into context.
How to do it?
In other words, I want to visualize a percentage, based on time amount depending on choosen period
I appreciate any help!
11 Replies
- amitchandak
Super User
Anonymous , Not ver clear, you can use distinctcount(date[date])
or datediff(min(date[date]),max(date[date]),Day)
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/- AnonymousNot applicable
I thought about this.
But it doesn't work if I have insufficient data.
For example, the week lasts from 1st to 7th.
I have only 2 incidents, closed within choosen week, one of them was closed on 2nd, the second - on 6th.
So, DATEDIFF(...) or COUNTROWS(CALENDAR(...)) will give wront result: 5 days.
I need 7.
- amitchandak
Super User
Anonymous , I think date diff should give you 7 take that from date table and calculate it in a measure first and then use