Forum Discussion
Running Total / cumulative by Group
- 9 years ago
Hi CahabaData you are true, lack of sequential field is the major issue.
You can achieve this using below steps.
1 - Add a sequence number. You can use RANKX function for this.
Rank = RANKX(SampleData,SampleData[Service ID],,ASC,Dense)
2 - Add RunningTotal using below formula
RunningTotal = CALCULATE ( SUM ( SampleData[Amount] ), ALLEXCEPT ( SampleData, SampleData[Group] ), SampleData[Rank] <= EARLIER ( SampleData[Rank] ) )This will give you desired results :)
- 9 years ago
You can first add an index column in Query Editor and then create a calculated column with EARLIER function to get the expected result.
GroupSum = SUMX ( FILTER ( Table1, EARLIER ( Table1[Group] ) = Table1[Group] && EARLIER ( Table1[Index] ) >= Table1[Index] ), Table1[Amount] )Best Regards,
Herbert
Hello All,
I am extremly new to the use of access so please bare with me if I do not understand any respones you have intitially. I have been trying to solve a problem I have within Access but I have not been able to find out any information specific to what I needd my Access database to do:
- I need to create a seqntial number based on the total of records for a customer
-I need this number to reset with every year.
-I need this number to be specific to sopecific to the customer.
-I'm not sure if I should create it as a query which appends the information to a table or as a Before change data macro.
Please help. I am really stuck and I'm at a dead end.
- CahabaData9 years ago
Memorable Member
Is your post a question about how to implement in the Microsoft Access database? -or- are you seeking to implement this in Power BI?
- B_339 years agoNew Member
its about how to implement this in Microsoft Access database,
Thanks
- CahabaData9 years ago
Memorable Member
You should post a Microsoft Access question here:
"https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev"
An application can add & store a sequential number per ID, at the time of data entry. But a database itself does not inherently generate such a value in its tables. But that approach would be unusual and would be problematic. If a record is legitimately deleted - then the sequential numbering must be re-generated to fill that gap. This is why such values are instead generated at the reporting level and not stored at the database table level.
Because the value typically does not exist in the database tables one would create these values at the reporting; in Microsoft Access reports these are not stored values but part of the report object presentation; in Power BI can either use Measures or Calculated Columns.