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
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
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.

Top Solution Authors