Forum Discussion
adityamalik1234
4 years agoFrequent Visitor
Counting occurence between dates
Hi Everyone,
My dataset looks like:
| Date | Product |
| 1/1/2022 | Table |
| 1/1/2022 | Chair |
| 1/1/2022 | Seat |
| 1/1/2022 | Monitor |
| 1/1/2022 | Monitor |
| 1/1/2022 | PC |
| 1/1/2022 | Laptop |
| 1/2/2022 | Table |
| 1/2/2022 | Chair |
| 1/2/2022 | Seat |
| 1/2/2022 | Monitor |
| 1/2/2022 | Laptop |
| 1/2/2022 | Laptop |
| 1/2/2022 | Table |
| 1/2/2022 | Chair |
I would like to add a 3rd column where occurence of product is counted. The output would look like:
| Date | Product | Occurence |
| 1/1/2022 | Table | 1st |
| 1/1/2022 | Chair | 1st |
| 1/1/2022 | Seat | 1st |
| 1/1/2022 | Monitor | 1st |
| 1/1/2022 | Monitor | 2nd |
| 1/1/2022 | PC | 1st |
| 1/1/2022 | Laptop | 2nd |
| 1/2/2022 | Table | 2nd |
| 1/2/2022 | Chair | 2nd |
| 1/2/2022 | Seat | 2nd |
| 1/2/2022 | Monitor | 2nd |
| 1/2/2022 | Laptop | 3rd |
| 1/2/2022 | Laptop | 4th |
| 1/2/2022 | Table | 3rd |
| 1/2/2022 | Chair | 3rd |
How do I achieve this in dax?
Thanks!
adityamalik1234 , You can create a Rank Column
A new column = rankx(filter(Table, [Product] =earlier([Product]) ), [Date],,asc,dense)
You can append text in a new column as per need
1 Reply
- amitchandakSuper User
adityamalik1234 , You can create a Rank Column
A new column = rankx(filter(Table, [Product] =earlier([Product]) ), [Date],,asc,dense)
You can append text in a new column as per need