Forum Discussion
Anonymous
4 years agoNot applicable
Count values between dates
Hi all! I need a DAX measure to count items between dates, example: item start end A 01/01/2022 03/01/2022 B 05/01/2022 10/01/2022 C 04/01/2022 06/01/2022 D 02/01/2022 ...
- 4 years ago
Hi, Anonymous
You can try the following methods.
Table:
calendar = CALENDAR(MIN('Table'[start]),MAX('Table'[end]))Measure:
quantity item = CALCULATE ( COUNT ( 'Table'[item] ), FILTER ( ALL ( 'Table' ), [start] <= SELECTEDVALUE ( 'calendar'[Date] ) && [end] >= SELECTEDVALUE ( 'calendar'[Date] ) ) )Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-zhangti
4 years agoCommunity Support
Hi, Anonymous
You can try the following methods.
Table:
calendar = CALENDAR(MIN('Table'[start]),MAX('Table'[end]))
Measure:
quantity item =
CALCULATE (
COUNT ( 'Table'[item] ),
FILTER (
ALL ( 'Table' ),
[start] <= SELECTEDVALUE ( 'calendar'[Date] )
&& [end] >= SELECTEDVALUE ( 'calendar'[Date] )
)
)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
Good night v-zhangti !
This solution works perfectly and solved the problem.Thanks a lot for the help!