Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
*Please see attached excel spreadsheet*
I was hoping someone could help with a current issue I am having. I am working to create a formula within Power BI that will overall fix the columns to what you see highlighted in yellow. The situation is that users are sometimes inputting incorrect quantities within the system, not inputting them at all, or inputting higher quantities than what they could have been able to work.
Below are some general rules that guide the values that I would like to see.
1) I would like the formula to start over every time a new Order ID is referenced, with the first step in the order being WC ID “HDR”
2) Order Qty is always standard and never changes
3) Compl Op Qty should always count down
4) If there is a difference between a row and the prior rows Compl Op Qty, then that difference should be reported in the current rows At Oper Qty
5) The Sum of At Oper Qty should equal the corresponding Order Qty
6) Amount of sequences is never standard and has infinite range.
7) There is 100’s of different order numbers, and this file would be updated multiple times daily.
I have attempted to write a formula into excel, but am still struggling. Ultimately, I would to add to new columns within Power BI query with new formulas that would be able to accomplish the above steps. This formula would repeat every time a new Order ID is referenced.
Thank you,
Jason
Hi @Anonymous ,
We can use the following steps to meet your requirement.
1. Create an index column in Power Query Editor.
2. Then we can create two calculated column.
Column =
VAR x =
CALCULATE (
SUM ( 'Table'[Compl OP Qty] ),
FILTER (
'Table',
'Table'[Index]
= EARLIER ( 'Table'[Index] ) - 1
&& 'Table'[OrderID] = EARLIER ( 'Table'[OrderID] )
)
)
VAR y =
IF ( ISBLANK ( x ), 0, x )
RETURN
IF (
'Table'[Compl OP Qty] = y,
'Table'[Compl OP Qty],
IF (
'Table'[Compl OP Qty] < y,
'Table'[Compl OP Qty],
IF ( y = 0, 'Table'[Compl OP Qty], y )
)
)
Column 2 =
VAR x =
CALCULATE (
SUM ( 'Table'[Column] ),
FILTER (
'Table',
'Table'[Index]
= EARLIER ( 'Table'[Index] ) - 1
&& 'Table'[OrderID] = EARLIER ( 'Table'[OrderID] )
)
)
var y = IF(ISBLANK(x),'Table'[Column],x)
return
ABS('Table'[Column]-y)
The result like this,
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
This looks perfect. Thank you for the assistance. I am still receiving issues. When attempting to add custom column, I receive an error after copying and pasting the provided formula. The error reads "Token Eof expected" .
Hi @Anonymous ,
Please create two calculate columns in Power BI Desktop not custom column in Power Query Editor. Please refer to following screenshot.
If you have any questions, please kindly ask here and we will try to resolve it.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
I was able to input them into a calcualted column, but I am still seeing errors. In workflow. Is there a way to attach an excel spreadsheet to this forum?
Hi @Anonymous ,
Please upload your files to OneDrive For Business and share the link here.
Please don't contain any Confidential Information or Real data in your reply.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
88 | |
63 |