Forum Discussion
Distinct calculation of dates within a range
- 2 years ago
Hi andi2333,
To point 1: You'll need to set up a proper calendar table (I'd recommend in Power Query) and set it up with whichever date dimension you want to use. There's loads of tutorials online how to do this, so I'll no go into any further depth here.
Point 2: Once you've got your calendar table, you can create a measure like this to get open tickets at the end of any given date dimension period:
_openTicketsOverTime = VAR __cDate = MAX(calendar[date]) RETURN CALCULATE( DISTINCTCOUNT(yourTable[TicketID]), FILTER( yourTable, yourTable[opened] <= __cDate && ( yourTable[closed] > __cDate || ISBLANK(yourTable[closed]) ) ) )Just make sure to use the period dimension from your calendar table on the chart axis.
Pete
Hi andi2333,
To point 1: You'll need to set up a proper calendar table (I'd recommend in Power Query) and set it up with whichever date dimension you want to use. There's loads of tutorials online how to do this, so I'll no go into any further depth here.
Point 2: Once you've got your calendar table, you can create a measure like this to get open tickets at the end of any given date dimension period:
_openTicketsOverTime =
VAR __cDate = MAX(calendar[date])
RETURN
CALCULATE(
DISTINCTCOUNT(yourTable[TicketID]),
FILTER(
yourTable,
yourTable[opened] <= __cDate
&& ( yourTable[closed] > __cDate || ISBLANK(yourTable[closed]) )
)
)
Just make sure to use the period dimension from your calendar table on the chart axis.
Pete