Forum Discussion
Trend from History Table
- 9 years ago
You may refer to the following DAX that creates a new table.
Table = ADDCOLUMNS ( CALENDARAUTO (), "Count", CALCULATE ( DISTINCTCOUNT ( Table1[Customer ID] ), FILTER ( Table1, Table1[Subscribed From] <= [Date] && ( Table1[Subscribed Until] > [Date] || ISBLANK ( Table1[Subscribed Until] ) ) ) ) )
Bump, anyone got any ideas here?
Thanks.
- v-chuncz-msft9 years agoCommunity Support
You may refer to the following DAX that creates a new table.
Table = ADDCOLUMNS ( CALENDARAUTO (), "Count", CALCULATE ( DISTINCTCOUNT ( Table1[Customer ID] ), FILTER ( Table1, Table1[Subscribed From] <= [Date] && ( Table1[Subscribed Until] > [Date] || ISBLANK ( Table1[Subscribed Until] ) ) ) ) )- Ruksuro9 years agoHelper III
Thanks for this v-chuncz-msft, worked perfectly.
Just for everyone else's information, this solution is not fast (given it's having to count each row multiple times it's not surprising). For a large dataset you might want this info precalculated at source.
Very impressed with DAX so far!
- kafil109 years agoFrequent Visitor
i tried this the figures don't much up really and the table begun from 01/01/1899 ??
Table =
ADDCOLUMNS (
CALENDARAUTO();
"Count"; CALCULATE (
COUNT ( Merge1[CallID] );
FILTER (
Merge1;
Merge1[NewColumn.DateAssign] <= [Date]
&& (
Merge1[NewColumn.DateResolv] > [Date]
|| ISBLANK ( Merge1[ClosedDate] )
)
)
)
) - Anonymous8 years agoNot applicable
Thank you for this, v-chuncz-msft! Worked beautifully.
What if I wanted to add another column that showed the number of subscribers that had been with us a year each day?