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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rsanjuan
Helper IV
Helper IV

Sum of values based on distinct values in other column

Hello,

 

Let's say there are two columns out of 20. 

 

 Capture.PNG

 

What's the correct measure syntax to sum up the Bid Value for each distinct Bid Number so that the sum would equal 50?

 

Thanks!

 

1 ACCEPTED SOLUTION

Hi @Rsanjuan,

 

In your scenario, you can create a calculate column first:

Column 1 =
IF (
    CALCULATE ( COUNTAX ( Master, Master[Bid Number] ) ) = 1,
    Master[Bit Value],
    Master[Bit Value] / ( CALCULATE ( COUNTAX ( Master, Master[Bid Number] ) ) )
)

Then, based on this calculated column, sum its total via measure:

Measure1 = SUM(Master[Column 1])

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

3 REPLIES 3
Vvelarde
Community Champion
Community Champion

@Rsanjuan

 

Hi Try with this:

 

BidValue per BidNumber =
SUMX(
VALUES('Bids'[BidNumber]);
CALCULATE(AVERAGE('Bids'[BidValue]))
)

 




Lima - Peru

@Vvelarde

 

I'm not sure if it's correct, it actually created an overall sum that is more.  Here's the actual expression I used:

 

TotalBidValue = SumX(Values(Master[Bid_Number__c]),CALCULATE(Average(Master[Bid Value])))

 

If I were to sum up the numbers in the chart above, the total would be 70 if we are not taking into account the duplicate bid numbers, but since we're adding up only the bid value when the bid numbers are distinct, it should be 50.

 

Did I do something wrong?

 

 

Hi @Rsanjuan,

 

In your scenario, you can create a calculate column first:

Column 1 =
IF (
    CALCULATE ( COUNTAX ( Master, Master[Bid Number] ) ) = 1,
    Master[Bit Value],
    Master[Bit Value] / ( CALCULATE ( COUNTAX ( Master, Master[Bid Number] ) ) )
)

Then, based on this calculated column, sum its total via measure:

Measure1 = SUM(Master[Column 1])

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.