The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi Guys,
We have a aggregate table of subscribers grouped into their common start dates and end dates. We want to be able to have one measure that, irrespective of which date dimension being used in the chart it, could count the number of active subscriptions. Active meaning that their subscription had not ended before the start of the date range (their end date can be within the date range)
Below is what we are using at the moment - but I'm pretty sure when we use this Measure on anything other than [Date] it calculates incorrectly. I would like a measure that would do this even if [month]/[week]/[quarter] .etc is selected.
-----------------------------------------------------------------------------------------------------
Hi, @Alex1988
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Calendar(a calculated table):
Calendar = CALENDARAUTO()
There is no relationship between two tables. You may create a measure as below.
Subscriber Base =
var _minperiod = CALCULATE(MIN('Calendar'[Date]),ALLSELECTED('Calendar'))
var _maxperiod = CALCULATE(MAX('Calendar'[Date]),ALLSELECTED('Calendar'))
var tab =
ADDCOLUMNS(
'Table',
"Flag",
IF(
NOT(
OR(
[End Date]<_minperiod,
[Start Date]>_maxperiod
)
),
1,0
)
)
return
SUMX(
FILTER(
tab,
[Flag]=1
),
[SubscriberCount]
)
Finally you may use the 'Date' column from 'Calendar' table to filter the result.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.