Forum Discussion

andi2333's avatar
andi2333
Icon for Helper I rankHelper I
2 years ago
Solved

Distinct calculation of dates within a range

Hello, I require support on the following issue (quite new to PBI, hence not entirely sure if there is a simple solution to this).   I have a table which essentially carries ticket IDs, some ticket...
  • BA_Pete's avatar
    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