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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
danielcontente
Helper II
Helper II

sum of unique values with two filters

Hi, 

 

I have a table as below, and my goal is to have a Matrix table thats shows the cost of a "Campaign breakdown 2" per year.

The problem is that i have multiple values for each Campaign Breakdown2.

 

Would somebody be able to help with it?

Let mw know if you need the CSV.

Thank you

danielcontente_0-1631032720512.png

 

1 ACCEPTED SOLUTION

Hi,

To your matrix visual, drag Campaign Breakdown 2 and Campaign Year.  Write these measures:

Cost = max(data[cost amount])

Total cost = SUMX(values(Data[Campaign Breakdown 2]),[Cost])

Drag the second measure to the visual.

If this does not help, then share the link from where i can download your PBI file.


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

View solution in original post

8 REPLIES 8
v-janeyg-msft
Community Support
Community Support

Hi, @danielcontente 

 

You can create a single summraize table then use it to show the result in matrix visual.

 Like this:

Table = SUMMARIZE(Table1,[Campaign Breakdown 2],[Campaign],"amount",MAX(Table1[Amount]))

vjaneygmsft_0-1631264415072.png

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

sm_talha
Resolver II
Resolver II

You can Group By in the power query based on "Campaign Breakdown 2" and "Campaign Created Year" with Operation = Max to achieve your result. (I would suggest you to do this with a duplicate of your table because the main table could be used for other metric in its original form)

 

sm_talha_0-1631037048579.png

 

This will give you a table like this: 

 

sm_talha_1-1631037083177.png

 

Now you can use columns from this grouped table to achieve your desired result. 

sm_talha_2-1631037177131.png

 

Hi @sm_talha thanks for helping.

However, by cretaing another table with a group by, i will not have these metrics on my fact table, which will stop me of building a unified visual.

 

Do you  have another alternative?

 

Try this, but it will give you max only in matrix's total as well. 

Measure = MAXX( 'Table', 'Table'[Cost Amount])

 

Yes.

I have done it using the MAX formula, but the total for the year is also the max.

Is there anyway i can obtain the same result but with the total in the Matrix?

Hi,

To your matrix visual, drag Campaign Breakdown 2 and Campaign Year.  Write these measures:

Cost = max(data[cost amount])

Total cost = SUMX(values(Data[Campaign Breakdown 2]),[Cost])

Drag the second measure to the visual.

If this does not help, then share the link from where i can download your PBI file.


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

Much thanks!

You are welcome.


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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.