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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
pakovic
Helper I
Helper I

Create measure that calculates the difference between one row and another

Sorry My English is not so good.

 

I would like to know if it is possible to create a measure that calculates the difference between the seller Peter and the other sellers (these are sales in this year)

 

 

vendedorimporte
Peter3300
Frank2150
John2000
David600

 

I would like powerbi to show this

vendedorimportedifer. Peter% dif. Peter
Peter330000
Frank2150115034,84
John2000130039,39
David600270081,81

 

this is the link to pbix to do test.

https://drive.google.com/open?id=1JLupC_VSkdcV8dHlP_BcKfeTEiRhYsZU

 

Thank you for your attention

2 ACCEPTED SOLUTIONS
nandukrishnavs
Community Champion
Community Champion

@pakovic 

 

Try this DAX measures

 

Difference = 
var _peter= SUMX(FILTER(ALLSELECTED('Table'),'Table'[vendedor]="Peter"),'Table'[Importe])
var _selected =SUMX(FILTER('Table','Table'[vendedor]=SELECTEDVALUE('Table'[vendedor])),'Table'[Importe])
var _difference= _peter-_selected
return _difference

 

% diff = 
var _peter= SUMX(FILTER(ALLSELECTED('Table'),'Table'[vendedor]="Peter"),'Table'[Importe])
var _percentage= [Difference]/_peter
return _percentage



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

View solution in original post

AlB
Community Champion
Community Champion

Hi @pakovic 

1. Place Table1[vendedor] in a table visual 

2. Place these measures in the visual (note we are not placing Table1[importe] any more, we have built a measure for it)

Importe_Measure = SUM(Table1[Importe]) 
difer. Peter = 
CALCULATE([Importe_Measure], Table1[vendedor] = "Peter") - [Importe_Measure] 
difer. Peter % = 
DIVIDE([difer. Peter], CALCULATE([Importe_Measure],Table1[vendedor]="Peter"))

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

3 REPLIES 3
AlB
Community Champion
Community Champion

Hi @pakovic 

1. Place Table1[vendedor] in a table visual 

2. Place these measures in the visual (note we are not placing Table1[importe] any more, we have built a measure for it)

Importe_Measure = SUM(Table1[Importe]) 
difer. Peter = 
CALCULATE([Importe_Measure], Table1[vendedor] = "Peter") - [Importe_Measure] 
difer. Peter % = 
DIVIDE([difer. Peter], CALCULATE([Importe_Measure],Table1[vendedor]="Peter"))

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

nandukrishnavs
Community Champion
Community Champion

@pakovic 

 

Try this DAX measures

 

Difference = 
var _peter= SUMX(FILTER(ALLSELECTED('Table'),'Table'[vendedor]="Peter"),'Table'[Importe])
var _selected =SUMX(FILTER('Table','Table'[vendedor]=SELECTEDVALUE('Table'[vendedor])),'Table'[Importe])
var _difference= _peter-_selected
return _difference

 

% diff = 
var _peter= SUMX(FILTER(ALLSELECTED('Table'),'Table'[vendedor]="Peter"),'Table'[Importe])
var _percentage= [Difference]/_peter
return _percentage



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

thank you very Much !!!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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