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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
kasife
Helper V
Helper V

Distinct SUM

Hi Guys,

I would like to get the distinct sum by project and by module. I have a sales table with several lines, and when I add the value of the project, the result is multiplied. How could I do it?example:

kasife_1-1687026157015.png

 

Im using the following measure, but the result is incorrect:

SUMX ( DISTINCT (ultimoReaalDivulgado[VGV Venda] ), ultimoReaalDivulgado[VGV Venda] )

kasife_2-1687026287391.png

 

 

 

 

 

1 ACCEPTED SOLUTION
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

try this measure:

 

Total sales = SUMX(DISTINCT('Table'[Module]),MAX('Table'[Sales Value]))
 
DOLEARY85_0-1687033704254.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

 
 

View solution in original post

10 REPLIES 10
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

https://1drv.ms/u/s!AiUZ0Ws7G26RiHk-scKQgUfACrhQ?e=nqG9Z6

Screen Capture #1283.png

@Ahmedx thank you so much. it worked perfectly

DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

try this measure:

 

Total sales = SUMX(DISTINCT('Table'[Module]),MAX('Table'[Sales Value]))
 
DOLEARY85_0-1687033704254.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

 
 

Hi @DOLEARY85 the sum is incorret. 

Apologies i sent the wrong one, try this instead:

 

Total sales = SUMX(DISTINCT('Table'[Module]),FIRSTNONBLANK('Table'[Sales Value],0))
 
DOLEARY85_0-1687075510742.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Hello 

 

please can you advise how to add a filter to this formula please?

 

the formula is great but what if i wanted to do based on condition of another column e.eg Rag = "Red"

 

please can you advise

You could try this:
 
Total sales = CALCULATE(SUMX(DISTINCT('Table'[Module]),FIRSTNONBLANK('Table'[Sales Value],0)),'Table'[RAG]="Red")
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

@DOLEARY85 thank you so much. it worked perfectly

Hi,

Share the download link of the PBI file.


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

Hi @Ashish_Mathur 

The link 

https://ufile.io/lmi0l5jr

 

Helpful resources

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

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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