Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Given the data in Table1:
+----------+-----------+----------+ | memberId | startDate | endDate | +----------+-----------+----------+ | 123 | 1/1/2016 | 1/1/2017 | | 124 | 5/1/2016 | | | 125 | 5/1/2016 | 1/1/2018 | +----------+-----------+----------+
I can easily compute number of active members at any given time using a variation of this answer as follows:
activeMembers = VAR compareDate = MAX ('Date'[Date]) RETURN CALCULATE ( COUNTROWS (Table1); FILTER ( Table1; (Table1[startDate] <= compareDate && (Table1[endDate] >= compareDate || ISBLANK(Table1[endDate])) ) )
Now if I would like to get moving average of e.g. past three months of this newly computed measure, how would I go about it?
Solved! Go to Solution.
@alpaca,
I make a test using your sample data, please review the DAX in the following PBIX file.
https://1drv.ms/u/s!AhsotbnGu1NogyhWef_gCnS-GJ7M
Regards,
Lydia
@alpaca,
I make a test using your sample data, please review the DAX in the following PBIX file.
https://1drv.ms/u/s!AhsotbnGu1NogyhWef_gCnS-GJ7M
Regards,
Lydia
Given the data in Table1:
+----------+-----------+----------+ | memberId | startDate | endDate | +----------+-----------+----------+ | 123 | 1/1/2016 | 1/1/2017 | | 124 | 5/1/2016 | | | 125 | 5/1/2016 | 1/1/2018 | +----------+-----------+----------+
I can easily compute number of active members at any given time using a variation of this answer as follows:
activeMembers = VAR compareDate = MAX ('Date'[Date]) RETURN CALCULATE ( COUNTROWS (Table1); FILTER ( Table1; (Table1[startDate] <= compareDate && (Table1[endDate] >= compareDate || ISBLANK(Table1[endDate])) ) )
Now if I would like to get moving average of e.g. past three months of this newly computed measure, how would I go about it?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
98 | |
79 | |
64 | |
56 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |