Forum Discussion
Help With Cumulative Total
- 2 years ago
Thank you for reaching back out, I found a resolution by doing a grouping and running total that way. I appreciate your time and efforts in trying to help me resolve this.
Good morning, I was able to nearly get this fixed by doing this function in the advanced editor, however it is not working once the [UnitofMeasureConvFactor]>1. So I am still working through that. I was able to create a measure that accounts for it being >1 but the column is not subtracting the quantity from the output of that measure to continue the running total from there.
GroupedTable = Table.Group(
#"Reordered Columns",
{"ItemCode"},
{
{"AllData", each
let
DataTable = _,
RunningTotalList = List.Accumulate(
DataTable[Qty],
{},
(state, current) => state & {if List.IsEmpty(state) then current else List.Last(state) + current}
),
AddRunningTotal = Table.FromColumns(
Table.ToColumns(DataTable) & {RunningTotalList},
Table.ColumnNames(DataTable) & {"RunningTotal"}
)
in
AddRunningTotal
}
}
)
Hi JustAThought ,
I'm not clear about your requirement. The [UnitofMeasureConvFactor] is a fact field or measure? Where the condition [UnitofMeasureConvFactor]>1 be applied? Could you please provide some sample data(exclude sensitive data) in your table 'Append1' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
- JustAThought2 years agoFrequent Visitor
Thank you for reaching back out, I found a resolution by doing a grouping and running total that way. I appreciate your time and efforts in trying to help me resolve this.
- Anonymous2 years agoNot applicable
Hi JustAThought ,
It's glad to hear that your problem has been resolved. Thanks for sharing your solution here. Could you please mark your post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.
Best Regards