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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.