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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
tietvinhphuc
Frequent Visitor

Sum duplicate value of materials by region, country

Hi everyone,

 

I have table of material number with plant, country, region, quantity and value.

The materials can exists in serveral plants.

It can happen several plants in a country.

And I want to explore the duplicated materials

2024-11-27_16h07_55.png

I want to create a table to show by region, country and how many materials are duplicated and sum of duplicated quantity and value. And as data above, the duplicated found in Germany, Europe and total value is 60.83 +0 = 60.83, total duplicated part 7+4 = 11

tietvinhphuc_0-1732698623833.png

 

 

 

Thanks,


BRs,

 

Phuc

 

 

1 ACCEPTED SOLUTION
shafiz_p
Super User
Super User

Hi @tietvinhphuc 

Create below 3 measure:

Measure 1:

DuplicatedMaterials = 
CALCULATE(
    COUNTROWS('Table'),
    FILTER(
        'Table',
        COUNTROWS(
            FILTER(
                'Table',
                'Table'[MATNR] = EARLIER('Table'[MATNR])
            )
        ) > 1
    )
)

 

Measure 2:

SumDuplicatedQuantity = 
CALCULATE(
    SUM('Table'[Quantity]),
    FILTER(
        'Table',
        COUNTROWS(
            FILTER(
                'Table',
                'Table'[MATNR] = EARLIER('Table'[MATNR])
            )
        ) > 1
    )
)

 

Measure 3:

SumDuplicatedValue = 
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        'Table',
        COUNTROWS(
            FILTER(
                'Table',
                'Table'[MATNR] = EARLIER('Table'[MATNR])
            )
        ) > 1
    )
)

 

Output:

shafiz_p_0-1732699731061.png

 

All the other regions are blank , that's why not showing those rows. If you need to show rows with no data, follow below steps:
Right click on Region column and select show item with no data. See image:

shafiz_p_1-1732699832879.png

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @tietvinhphuc ,

 

try like:

duplicate qty=

SUMX(

FILTER(

ADDCOLUMNS(

SUMMARIZE(data, data[region], data[country]),

"Count", CALCULATE(COUNTROWS(data)),

"Qty", CALCULATE(SUM(data[quantity])

),

[Count]>1

),

[Qty]

)

 

 

duplicate value=

SUMX(

FILTER(

ADDCOLUMNS(

SUMMARIZE(data, data[region], data[country]),

"Count", CALCULATE(COUNTROWS(data)),

"@value", CALCULATE(SUM(data[value])

),

[Count]>1

),

[@value]

)

shafiz_p
Super User
Super User

Hi @tietvinhphuc 

Create below 3 measure:

Measure 1:

DuplicatedMaterials = 
CALCULATE(
    COUNTROWS('Table'),
    FILTER(
        'Table',
        COUNTROWS(
            FILTER(
                'Table',
                'Table'[MATNR] = EARLIER('Table'[MATNR])
            )
        ) > 1
    )
)

 

Measure 2:

SumDuplicatedQuantity = 
CALCULATE(
    SUM('Table'[Quantity]),
    FILTER(
        'Table',
        COUNTROWS(
            FILTER(
                'Table',
                'Table'[MATNR] = EARLIER('Table'[MATNR])
            )
        ) > 1
    )
)

 

Measure 3:

SumDuplicatedValue = 
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        'Table',
        COUNTROWS(
            FILTER(
                'Table',
                'Table'[MATNR] = EARLIER('Table'[MATNR])
            )
        ) > 1
    )
)

 

Output:

shafiz_p_0-1732699731061.png

 

All the other regions are blank , that's why not showing those rows. If you need to show rows with no data, follow below steps:
Right click on Region column and select show item with no data. See image:

shafiz_p_1-1732699832879.png

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.