Forum Discussion
Create a new column based on distinct result
Hi Jimmy801 ,
Good day.
I cant say if this is a MAX-Calculation since I dont have any idea. But the amounts indicated there are distinct and might be based on the document submitted. For example:
1200 is the total amount of all the BULK receipts. The reason to have 1000 amount in question, might pertain to a one receipt with an amount of 1000 and we need to raise an issue. That is why we showed it in a diffrent row. On the other hand, once we raised, 1200 meaning all of the receipts have same issue only and applied to all.
I hope I answer your question 🙂
Thanks and regards
Hello Anonymous
sorry, I don't get what you want to have calculated in your custom column.
Your data model shows this with values of 1200, 1200 1000 an d1200 in the colum AMOUNT IN QUESTION
Your grouped table shows this
I have to know how this column is grouped/created.
BR
Jimmy
- Anonymous6 years agoNot applicable
Hi Jimmy801 ,
Good day.
Apology on that. The table was created by using this formula in excel:
"Per Original Unique Reference, if Spend Expense Amount (USD) based on Original (Y) is greater than Sum of Amount in Question, then value is equal the Spend Expense Amount. Otherwise, Sum of Amount in Question."
To illustrate, for example:
ORIGINAL UNIQUE REFERENCE # (sequence per line item, i.e. 1,2,3) of Inserted Line NEW UNIQUE REFERENCE ORIGINAL (Y) Customer Name Spend - Expense Amount (USD) AMOUNT IN QUESTION SPECIFIC
AUDIT ISSUECurrent Audit Status OrigUniqRef_01 OrigUniqRef_01 Y Customer A 1,200.00 1,200.00 Expense for Clarification With Issue OrigUniqRef_01 1 OrigUniqRef_01.L1 Customer A 1,200.00 1,200.00 Business Purpose Not Provided With Issue OrigUniqRef_01 2 OrigUniqRef_01.L2 Customer A 1,200.00 1,000.00 Only Credit Card Slip/Statement is provided. With Issue OrigUniqRef_01 3 OrigUniqRef_01.L3 Customer A 1,200.00 1,200.00 No Time Charges With Issue The Spend Amount in (Y) is = 1200
Sum Amount in Question = 4600
Then, for this Uniq Ref#, the audit result amount will show = 1200. (Because the original amount for this particular Row is 1200 only).
However, if there are errors in our formula, we check the audited file and edit it manually. For another example,
ORIGINAL UNIQUE REFERENCE # (sequence per line item, i.e. 1,2,3) of Inserted Line NEW UNIQUE REFERENCE ORIGINAL (Y) Customer Name Spend - Expense Amount (USD) AMOUNT IN QUESTION SPECIFIC
AUDIT ISSUECurrent Audit Status OrigUniqRef_02 OrigUniqRef_02 Y Customer B 1,500.00 900.00 Receipt not provided With Issue OrigUniqRef_02 1 OrigUniqRef_02.L1 Customer B 1,500.00 900.00 Expense for Clarification With Issue The Spend Amount in (Y) is = 1500
Sum Amount in Question = 1800
Technically, the amount must appear only is 900 because the only amount with raised issue is the receipt with 900 in amount. However, it appears wrong if we use the formula we created for this Audit Result column that is why other rows with the same kind of scenario, we edit it and correct it manually.
I hope I got this one as answer to your question. 🙂
Thanks and regards,
Echo
- Anonymous6 years agoNot applicable
Hi Jimmy801
Good day.
Just to add, any suggestion is open if you have as we are still on our process of developing our report team.
Thanks
- Jimmy8016 years agoCommunity Champion
Hello Anonymous
try out this solution. It uses Table.Group and depending on your indicated conditions, applies different calculations.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("vZPRSsMwFIZf5dDr0qUZXuzSBS8E2camiIwhYT3dDrRJTNIx38Zn8cnMxSZoI81NpclFkj/w/eTrdpstLR2eFL2tsX5lZZZnYfT2XsIUnfO6RQu3YfH58fcHZc4ZKxgbyP1M3p0NKodQawuikZZq2ktPWoWzZ/JHuHeuw2yXR5DLHnPxcKkyMvW8c6TQOVh11uiAv9AeVlafqMIqgZxHyPmY5OyaXKrmHYTFijwIaSvYNGQmGy89tqg8kANz6VEkFJlGikz/5QkWGh6pRRBHaQ/oBlh5xHD+2/D5MOhNGuj3jdk1v8Y9kvGggigmTRQeU5z3FR8TO/X33H0B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"ORIGINAL UNIQUE REFERENCE" = _t, #"# (sequence per line item, i.e. 1,2,3) of Inserted Line " = _t, #"NEW UNIQUE REFERENCE" = _t, #"ORIGINAL (Y)" = _t, #"Customer Name" = _t, #" Spend - Expense Amount (USD) " = _t, #" AMOUNT IN QUESTION " = _t, SPECIFIC = _t, #"Current Audit Status" = _t]), #"Renamed Columns1" = Table.RenameColumns(Source,{{" Spend - Expense Amount (USD) ", "Spend - Expense Amount (USD)"}}), #"Renamed Columns" = Table.RenameColumns(#"Renamed Columns1",{{" AMOUNT IN QUESTION ", "AMOUNT IN QUESTION"}}), Trans = Table.TransformColumns(#"Renamed Columns",{{"AMOUNT IN QUESTION", each Number.From(_, "en-US"), Int64.Type}, {"Spend - Expense Amount (USD)", each Number.From(_, "en-US"), Int64.Type}}), #"Grouped Rows" = Table.Group(Trans, {"ORIGINAL UNIQUE REFERENCE"}, {{"Custom", (group)=> if List.Max(group[#"Spend - Expense Amount (USD)"])> List.Sum(group[AMOUNT IN QUESTION]) then List.Sum(group[AMOUNT IN QUESTION]) else List.Max(group[#"Spend - Expense Amount (USD)"]) , type number}}) in #"Grouped Rows"Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy