Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Good afternoon, I am trying to get a Cumulative Total to show based on ItemCode. Start with DataType="S" (for stock) and then if it is a S/O data type (deduct) or P/O Datatype (Increase) to show if the stock is increasing or decreasing with each order entry.
I created this measure but it is not calculating properly
VAR CurrentDate = MAX('Append1'[Date])
VAR CurrentIndex = MAX('Append1'[Index])
VAR CurrentItemCode = MAX('Append1'[ItemCode])
RETURN
CALCULATE(
SUM('Append1'[QTY]),
FILTER(
ALLSELECTED('Append1'),
'Append1'[ItemCode] = CurrentItemCode &&
('Append1'[Date] < CurrentDate ||
('Append1'[Date] = CurrentDate && 'Append1'[Index] <= CurrentIndex))))
So I need it to start with the 77553.92 and then take that number and decrease by 2000, then take the new output and decrease by 4000. Not sure if this is possible or not. So I have one page that has a full view of every ItemCode, the user can then right click and drill through to their desired ItemCode and it will show this QTY column.
Qty column is:
QTY |
77553.92 |
-2000 |
-4000 |
-1000 |
-20000 |
20000 |
-2000 |
-20000 |
40000 |
-20000 |
-3000 |
-8000 |
-8000 |
-2000 |
-6000 |
Solved! Go to Solution.
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
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.
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
here is an example of the table: it is the QTYRunning I am trying to create
Hi @JustAThought ,
Assume that there is the field [Index] exist in the table 'Append1' and order the data by the field [DateType] (from S,S/O to P/O). You can update the formula of your measure [QTYRunning] as below:
QTYRunning =
VAR CurrentDate =
MAX ( 'Append1'[Date] )
VAR CurrentIndex =
MAX ( 'Append1'[Index] )
VAR CurrentItemCode =
MAX ( 'Append1'[ItemCode] )
RETURN
CALCULATE (
SUM ( 'Append1'[QTY] ),
FILTER (
ALLSELECTED ( 'Append1' ),
'Append1'[ItemCode] = CurrentItemCode
&& 'Append1'[Date] <= CurrentDate
&& 'Append1'[Index] <= CurrentIndex
)
)
If the above one can't help you figure out, please provide some raw 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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
80 | |
53 | |
39 | |
39 |
User | Count |
---|---|
104 | |
85 | |
47 | |
44 | |
43 |