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
drpiet
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
v-chuncz-msft
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
v-chuncz-msft
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.

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.