cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Sum values if combination of 2 columns is unique.

Hi,

 

I have a table with the below values (this is a DirectQuery to an Azure SQL DB).

 

table.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

As you can see that is a list of VMs per region and per SKU (type of VM). I need to be able to summarize the amount of VMs to be able to show how many we have per region. 
The problem is we have some duplicates (we need them unfortunatelly), so when I group by region and SUM the value of "VMsAmount" it is duplicating some amount, for instance the selected row on the screenshot and the row below needs to be added just once.

The result I'm looking for with the above data is:

 

table2.jpg

 

 

 

 

 

 

Unfortunatelly I'm receiving 137 for the westeurope region for that duplicate row.

 

Thank you guys.

 

1 ACCEPTED SOLUTION
Community Support
Community Support

@drpiet,

 

You may use measure below.

Measure =
SUMX (
    SUMMARIZE ( Table1, Table1[Location], Table1[SKU] ),
    CALCULATE ( MAX ( Table1[VMSAmount] ) )
)
Community Support Team _ Sam Zha
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

1 REPLY 1
Community Support
Community Support

@drpiet,

 

You may use measure below.

Measure =
SUMX (
    SUMMARIZE ( Table1, Table1[Location], Table1[SKU] ),
    CALCULATE ( MAX ( Table1[VMSAmount] ) )
)
Community Support Team _ Sam Zha
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

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors