Forum Discussion
Anonymous
7 years agoNot applicable
Create a measure as observation
Hi Everyone,
| Year Month | ID | OBS |
| 2018-07 | A | 1 |
| 2018-07 | B | 2 |
| 2018-08 | C | 1 |
| 2018-09 | D | 1 |
| 2018-09 | E | 2 |
| 2018-09 | F | 3 |
I have a simple table like this and would like to create a measure (OBS) to display the record count of each month.
Could anyone tell me how to make it happen in DAX? Thank you in advance for the support!
Hi Anonymous,
You should first add an index column in Query Editor mode.
Then, create below measure.
OBS = COUNTROWS ( FILTER ( ALL ( 'Table2 2' ), 'Table2 2'[Year Month] = SELECTEDVALUE ( 'Table2 2'[Year Month] ) && 'Table2 2'[Index] <= MAX ( 'Table2 2'[Index] ) ) )Alternatively, you can achieve this via Power Query.
Best regards,
Yuliana Gu
1 Reply
- v-yulgu-msftMicrosoft Employee
Hi Anonymous,
You should first add an index column in Query Editor mode.
Then, create below measure.
OBS = COUNTROWS ( FILTER ( ALL ( 'Table2 2' ), 'Table2 2'[Year Month] = SELECTEDVALUE ( 'Table2 2'[Year Month] ) && 'Table2 2'[Index] <= MAX ( 'Table2 2'[Index] ) ) )Alternatively, you can achieve this via Power Query.
Best regards,
Yuliana Gu