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
rcb0325
Helper I
Helper I

Getting rid of duplicate values being added together

Hello! 

 

In the table I am building, it is relating customer groups, to a sales order, to an invoiced quantity. Each customer is assigned a rebate ID of either quarterly or annual. The issue I am having is that customers that have both a quarterly and annual rebate, the invoiced quantities are being doubled. 

 

I am wondering if there is a way to create a new measure for the invoiced quantities, that tells Power BI to look at the Rebate ID, and if there is both a quarterly and annual rebate for that customer, then divide the invoiced quantity by 2. Below are some pictures of my issue. Thank you! 
Capture.JPGCapture1.JPG


1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @rcb0325 ;

if  invoiced quantity is column,you could create a measure as:

 

InvoicedQuantity2 =
IF (
    CALCULATE (
        DISTINCTCOUNT ( [RebateProgramID] ),
        ALLEXCEPT ( 'Table', 'Table'[CustomerNumber] )
    ) = 2,
    AVERAGE ( [InvoicedQuantity] ) * 2,
    MAX ( [InvoicedQuantity] )
)

 

if  invoiced quantity is measure,you could create a measure as:

 

InvoicedQuantity3 =
IF (
    CALCULATE (
        DISTINCTCOUNT ( [RebateProgramID] ),
        ALLEXCEPT ( 'Table', 'Table'[CustomerNumber] )
    ) = 2,
    AVERAGEX ( 'Table', [InvoicedQuantitymea] ) * 2,
    [InvoicedQuantitymea]
)

 

The final output is shown below:

v-yalanwu-msft_0-1623745068300.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yalanwu-msft
Community Support
Community Support

Hi, @rcb0325 ;

if  invoiced quantity is column,you could create a measure as:

 

InvoicedQuantity2 =
IF (
    CALCULATE (
        DISTINCTCOUNT ( [RebateProgramID] ),
        ALLEXCEPT ( 'Table', 'Table'[CustomerNumber] )
    ) = 2,
    AVERAGE ( [InvoicedQuantity] ) * 2,
    MAX ( [InvoicedQuantity] )
)

 

if  invoiced quantity is measure,you could create a measure as:

 

InvoicedQuantity3 =
IF (
    CALCULATE (
        DISTINCTCOUNT ( [RebateProgramID] ),
        ALLEXCEPT ( 'Table', 'Table'[CustomerNumber] )
    ) = 2,
    AVERAGEX ( 'Table', [InvoicedQuantitymea] ) * 2,
    [InvoicedQuantitymea]
)

 

The final output is shown below:

v-yalanwu-msft_0-1623745068300.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

In the invoiced quantity measure, use the Min function instead of the Sum function.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Could the Average function be used? Or is there a reason that the Min function is the best option? 

Hi,

As long as the invoice quantity for the Customer Name remains the same, you should be able to use Max, min or average.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

I think you have bigger problems than that.  Your sales amount is also doubled.

 

Maybe the rule should be "Don't include a quarterly row if an annual row is present" ?

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors