Forum Discussion
Count a number of months after registration
- 6 years ago
Hi Anonymous ,
We can try to use the following measure to meet your requirement:
Measure = VAR d = MIN ( 'Dates'[Date] ) RETURN AVERAGEX ( FILTERS('Clients'[Client ID]), var i = [Client ID] var r = DATEDIFF ( CALCULATE ( MIN ( 'Clients'[Registration date] ), FILTER ( ALLSELECTED( 'Clients' ), 'Clients'[Client ID] = i ) ), d, MONTH ) return IF(r>0,r,BLANK()) )
Best regards,
In averagex try the first parameter as averagex(values(client[clientID])
Sorry, it did not help. 😞
https://drive.google.com/open?id=1odHd5gv2RkBBnvTFukZFBAm6T9uyq3Kx
- v-lid-msft6 years ago
Community Support
Hi Anonymous ,
We can try to use the following measure to met your requirement if two tables have 1:M relationship:
Measure = VAR d = MIN ( 'Dates'[Date] ) RETURN AVERAGEX ( FILTERS('Clients'[Client ID]), var i = [Client ID] return DATEDIFF ( CALCULATE ( MIN ( 'Clients'[Registration date] ), FILTER ( ALLSELECTED( 'Clients' ), 'Clients'[Client ID] = i ) ), d, MONTH ) )
Best regards, - Anonymous6 years agoNot applicable
Hi v-lid-msft ,
Yes, this measure works in the same way as shown in your image, thank you!
The only issue that is left that I need to avoid negative numbers in order to show a true average per month.
Filter by measure value doesn't help.
Could you help me with this?
- v-lid-msft6 years ago
Community Support
Hi Anonymous ,
We can try to use the following measure to meet your requirement:
Measure = VAR d = MIN ( 'Dates'[Date] ) RETURN AVERAGEX ( FILTERS('Clients'[Client ID]), var i = [Client ID] var r = DATEDIFF ( CALCULATE ( MIN ( 'Clients'[Registration date] ), FILTER ( ALLSELECTED( 'Clients' ), 'Clients'[Client ID] = i ) ), d, MONTH ) return IF(r>0,r,BLANK()) )
Best regards, - Anonymous6 years agoNot applicable
Hi v-lid-msft,
Great! It is perfect.
The only thing I changed is
return IF(r>=0,r,BLANK())Otherwise, the first month is lost.
Many many thanks!