Forum Discussion
bimchahaha
Microsoft Employee
5 years agoRolling count for all the years
How can I rolloing count for all the years I have in the table .?
suppose original table
ID Date
1 1/1/2020
2 1/2/2020
3 1/3/2020
4 1/1/2021
5 1/2/2021
6 1/3/2021
7 1/4/2021
and give
2020 2021
Count 3 7
??
Count Measure : =
VAR _currentyear =
MAX ( 'Year'[Year] )
RETURN
IF (
HASONEVALUE ( 'Year'[Year] ),
CALCULATE ( COUNTROWS ( Data ), 'Year'[Year] <= _currentyear )
)
2 Replies
- Jihwan_Kim
Super User
Count Measure : =
VAR _currentyear =
MAX ( 'Year'[Year] )
RETURN
IF (
HASONEVALUE ( 'Year'[Year] ),
CALCULATE ( COUNTROWS ( Data ), 'Year'[Year] <= _currentyear )
) - ryan_mayu
Super User
If you don't have a date table. you can create a year column
year = year('Table'[Date])and create a measureMeasure = COUNTX(FILTER(all('Table'),'Table'[year]<=max('Table'[year])),'Table'[Date])pls see the attachment below