The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Is there a way I can get a running count based on a reoccuring value in a column, and start a new running count based on new values? Please see the example below for what I am trying to achieve. When defining where to start counting, the data would most likely be sorted by a date column. Thank you!
ID | Desired Output |
A | 1 |
A | 2 |
A | 3 |
A | 4 |
A | 5 |
B | 1 |
B | 2 |
B | 3 |
B | 4 |
C | 1 |
C | 2 |
C | 3 |
D | 1 |
D | 2 |
D | 3 |
D | 4 |
E | 1 |
E | 2 |
E | 3 |
E | 4 |
E | 5 |
C | 4 |
A | 6 |
A | 7 |
Solved! Go to Solution.
HI,
If you can add an extra column which is the row number, i.e. 1,2,3,4,5,6... then the following logic should work:
Calculate(COUNTA(Table[ID]), FILTER(Table, Table[ID] = EARLIER(Table[ID]) && Table[Row Number] <= EARLIER(Table[Row Number])))
Essentially, if you are on row 1, A then this will filter your table to just be A's and then any row less than or equal to the current row number and then it will count the number of A's in this filtered table.
So A row 3 will filter the table to just A's and then all rows less than or equal to 3.
Hope this helps,
Will
HI,
If you can add an extra column which is the row number, i.e. 1,2,3,4,5,6... then the following logic should work:
Calculate(COUNTA(Table[ID]), FILTER(Table, Table[ID] = EARLIER(Table[ID]) && Table[Row Number] <= EARLIER(Table[Row Number])))
Essentially, if you are on row 1, A then this will filter your table to just be A's and then any row less than or equal to the current row number and then it will count the number of A's in this filtered table.
So A row 3 will filter the table to just A's and then all rows less than or equal to 3.
Hope this helps,
Will
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
83 | |
75 | |
50 | |
42 |
User | Count |
---|---|
140 | |
113 | |
73 | |
64 | |
62 |