Forum Discussion
Getting Invoice Total of specific line item
All -
I'm working with a invoice detail report and am trying to calculate the total invoice amount if/when I isolate a single line item. The output I'm currently seeing is that the result is multiplied by the times something is repeated within a specific line item.
Here is an example:
| Invoice Number | Product code | Amount |
| inv 123 | prod 1 | 100 |
| inv 123 | prod 2 | 250 |
| inv 123 | prod 3 | 200 |
| inv 123 | prod 2 | 250 |
| inv 123 | prod 2 | 250 |
| inv 123 | prod 4 | 150 |
| Total | 1200 |
THe current error I find is that when I search for prod 2, the total amount returned is 3600. The total amount of 1200 is counted 3 times due to prod 2 repeating.
The desired outcome is when i filter/search for invoices containing prod 2, it should be 1200 in this single instance
Hi Anonymous ,
Based on my test, you could create below measure:
Total amount = CALCULATE(SUM(Table1[Amount]),ALL(Table1))
Result:
You could also download the pbix file to have a view.
Regards,
Daniel He
4 Replies
- Ashish_Mathur
Super User
Hi,
Shouldn't the result e 250*3=750?
- v-danhe-msft
Microsoft Employee
Hi Anonymous ,
Waht is your desired result? If I select Prod 2, it will show 750:
Regards,
Daniel He
- AnonymousNot applicableThe desired result is 1200 for these invoices. This series is just one of many.
I want to know the sun for all of Inv123 when I select just prod 2.
I’m trying to determine the total spend if an invoice with many line items contained one particular line (prod 2)- v-danhe-msft
Microsoft Employee
Hi Anonymous ,
Based on my test, you could create below measure:
Total amount = CALCULATE(SUM(Table1[Amount]),ALL(Table1))
Result:
You could also download the pbix file to have a view.
Regards,
Daniel He