Hi
I have below Data and i want if DocNum repeats multiple times then RoundDif,InvoiceTotal should be displayed only once
| Invoice No | Quantity | Basic Value | Tax Amount | Round Diff | Invoice Total |
| 500273 | 513 | 18,940.00 | 2,272.80 | -0.27 | 23,529.00 |
| 500273 | 309 | 1,963.11 | 353.36 | -0.27 | 23,529.00 |
| 500286 | 965 | 3,840.55 | 460.87 | -0.42 | 4,301.00 |
Thanks
Tuhin PaulPosted Feb 28, 2025, 7:49 AM
Alternative Approach Using DAX
If you prefer to handle this in Power BI using DAX, you can create calculated columns to achieve the same result.
DAX Code
Indexcolumn in Power Query (as described above).Replace the original
Round DiffandInvoice Totalcolumns with these calculated columns in your visualizations.Tuhin PaulPosted Feb 28, 2025, 7:48 AM
After applying the above steps, your data will look like this:
Invoice No
Quantity
Basic Value
Tax Amount
Round Diff
Invoice Total
500273
513
18,940.00
2,272.80
-0.27
23,529.00
500273
309
1,963.11
353.36
500286
965
3,840.55
460.87
-0.42
4,301.00
Tuhin PaulPosted Feb 28, 2025, 7:26 AM
Step 1: Load Data into Power Query
Step 2: Add an Index Column
Adding an index column helps identify the first occurrence of each
Invoice No.Your data will now have an additional column called
Index.Step 3: Identify First Occurrence of Each Invoice No
Group the data by
Invoice Noto find the minimumIndexfor eachInvoice No.Invoice NoMinIndexMinimumIndexExpand the grouped data back to the original table:
MinIndexto bring back the original data.Step 4: Add Conditional Columns for
Round DiffandInvoice TotalNow, create conditional logic to display
Round DiffandInvoice Totalonly for the first occurrence of eachInvoice No.Round Diff:Round Diff Display.IndexequalsMinIndex, then displayRound Diff.Invoice Total:Invoice Total Display.IndexequalsMinIndex, then displayInvoice Total.Step 5: Remove Unnecessary Columns
Round DiffandInvoice Totalcolumns if they are no longer needed.Round Diff DisplayandInvoice Total Display) back toRound DiffandInvoice Total.Step 6: Load Data Back
Tuhin PaulPosted Feb 28, 2025, 7:26 AM
To achieve the desired output where
Desired OutputRound DiffandInvoice Totalare displayed only once for repeatedInvoice No, you can use Power Query in Power BI or Excel to transform the data.For your example data, the transformed table should look like this:
Invoice No
Quantity
Basic Value
Tax Amount
Round Diff
Invoice Total
500273
513
18,940.00
2,272.80
-0.27
23,529.00
500273
309
1,963.11
353.36
500286
965
3,840.55
460.87
-0.42
4,301.00
Eliana BlakePosted Feb 28, 2025, 7:00 AM
In the data provided, you mentioned that if DocNum repeats multiple times, then RoundDif and InvoiceTotal should be displayed only once. This approach is commonly used to summarize the RoundDif and InvoiceTotal values when there are multiple entries for the same document number.
For example, in the table you shared:
- For Invoice No 500273, the Round Difference is -0.27 and Invoice Total is 23,529.00. These values are consistent across both entries with the same Invoice No.
- Similarly, for Invoice No 500286, the Round Difference is -0.42 and the Invoice Total is 4,301.00.
By displaying RoundDif and InvoiceTotal only once for each unique DocNum, you can provide a more concise and summarized view of the data while still capturing the essential information associated with each document.
This approach is helpful in scenarios where you want to avoid redundant information and focus on key metrics or totals associated with each document or transaction. It streamlines the presentation of data, making it easier to interpret and analyze, especially when dealing with large datasets or repetitive entries.
If you have any more questions or need further clarification on this topic, feel free to ask!