Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
SchoolBoy
Frequent Visitor

Sum and duplicate data

Hi,

 

How do I calculate the total of all invoices for the following table?

In this situation a single order from a specific customer may appear in several waybills.

The value in “order value” field refers to total value of specific invoice (and repeats in several lines)

I am trying to use the following notation and get erroneous data:


Total__inv = SUMX(

    SUMMARIZE('waybill_table';'waybill_table'[Invoice]; waybill_table'[order value]);

  waybill_table'[order value])

 

day: 2020.01.01 customer: 00001 Invoice:000001 order value: 12 000 waybill number:1111111111

day: 2020.01.02 customer: 00001 Invoice:000001 order value: 12 000 waybill number:1111111112

day: 2020.01.03 customer: 00001 Invoice:000001 order value: 12 000 waybill number:1111111113

day: 2020.01.01 customer: 01011 Invoice:000032  order value: 15 300 waybill number:2111111123

day: 2020.01.01 customer: 01011 Invoice:000032 order value: 15 300 waybill number:3111111125

day: 2020.01.01 customer: 01055 Invoice:000134 order value: 5 300 waybill number: 4111125

day: 2020.01.01 customer: 01055 Invoice:000143 order value: 6 300 waybill number: 676111125

day: 2020.01.01 customer: 00001 Invoice:001231 order value: 300 waybill number: 123376111125

day: 2020.01.02 customer: 00001 Invoice:001232  order value: 300 waybill number: 123376111126

day: 2020.01.02 customer: 00001 Invoice:100003 order value: 2 300 waybill number: 123376111126

 

Thanks 🙂

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@SchoolBoy , Try like

Total__inv = SUMX(

SUMMARIZE('waybill_table';'waybill_table'[Invoice]; 'waybill_table'[order value]);[order value])
OR
Total__inv = SUMX(
SUMMARIZE('waybill_table';'waybill_table'[Invoice]; "_1";max('waybill_table'[order value]));[_1])

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@SchoolBoy , Try like

Total__inv = SUMX(

SUMMARIZE('waybill_table';'waybill_table'[Invoice]; 'waybill_table'[order value]);[order value])
OR
Total__inv = SUMX(
SUMMARIZE('waybill_table';'waybill_table'[Invoice]; "_1";max('waybill_table'[order value]));[_1])

Thank you 🙂

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.