Forum Discussion
How to calculate active subscriptions with an initial and final date
- 9 years ago
Hi Dario,
if you add a MIN and MAX to your "NumSubscriptions"-expression, it should work as a measure instead of a column (provided there is no (!) connection to the datedimension-table !):
NumSubscriptions = COUNTROWS( FILTER( Table1, Table1[InicialDate].[Date] <= MIN(datedimension[date]) && Table1[FinalDate] >= MAX(dateimension[date]) ) )
Hi Dario,
you can try a calculated measure in your date table, sth along the lines of:
NumSubscriptions =
COUNTROWS(
FILTER( ALL( data ), data[start] <= MIN( 'Day'[Day] ) && data[end2] > MAX( 'Day'[Day] ) )
)You can find a demo PBIX here
HTH,
Frank
Hi,
With new column in datedimension table.
NumSubscriptions =
COUNTROWS(
FILTER( Table1, Table1[InicialDate].[Date] <= datedimension[date] && Table1[FinalDate] >= dateimension[date] )
)
With one column for type and 1 line for each type I can add one more filter to do this.
My problem is this table in future is very big, if i can make this with a mesure is better.
Best Regards,
Dário Santos
- ImkeF9 years ago
Community Champion
Hi Dario,
if you add a MIN and MAX to your "NumSubscriptions"-expression, it should work as a measure instead of a column (provided there is no (!) connection to the datedimension-table !):
NumSubscriptions = COUNTROWS( FILTER( Table1, Table1[InicialDate].[Date] <= MIN(datedimension[date]) && Table1[FinalDate] >= MAX(dateimension[date]) ) )