Forum Discussion
zxmon21
3 years agoNew Member
Counting rows with dates before [any date from a date-table]
Hi, I'm trying to find the number of items that we've purchased before any given time. I'm starting with a table with one row per item and purchase date (simplified, there are a LOT more columns in...
- 3 years ago
Hi zxmon21 ,
Please try following DAX:
Measure = IF( ISINSCOPE('Table'[Type]), CALCULATE(COUNT('Table'[Type]),FILTER(ALL('Table'),'Table'[Type] = SELECTEDVALUE('Table'[Type]) && 'Table'[PurchDate] <= SELECTEDVALUE('Date'[PurchDate]))), CALCULATE(COUNT('Table'[Type]),FILTER(ALL('Table'),'Table'[PurchDate] <= SELECTEDVALUE('Date'[PurchDate]))) )Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yadongf-msft
Community Support
3 years agoHi zxmon21 ,
Please try following DAX:
Measure = IF(
ISINSCOPE('Table'[Type]),
CALCULATE(COUNT('Table'[Type]),FILTER(ALL('Table'),'Table'[Type] = SELECTEDVALUE('Table'[Type]) && 'Table'[PurchDate] <= SELECTEDVALUE('Date'[PurchDate]))),
CALCULATE(COUNT('Table'[Type]),FILTER(ALL('Table'),'Table'[PurchDate] <= SELECTEDVALUE('Date'[PurchDate])))
)
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.