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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculate difference between values of a column from a particular value of same column

 Hello,

 

 I am trying to calculate the difference between values of a column from a particular value of same column. I want to create a DAX field - "Diff of Bill from F" that calculate the difference in bill from the bill of  Company F. I also have a rank column based on the bill amount but I am not sure if that could be used to calculate this.

I am currently stuck on this, I've found similar questions but I couldn't apply them to my problem as most of them are calculating consecutive differences. 

 

 

YearMonthCompanyBillDiff of Bill from F
2020JuneA954-181
2020JuneB949-176
2020JuneC908-135
2020JuneD811-38
2020JuneE809-36
2020JuneF7730
2020JuneG75419

 

Any help would be greatly appreciated.

 

Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you. I was able to solve by doing a slight change in the DAX. Using below DAX I was able to get the desired result.

 

Diff = var f = CALCULATE([Annual Bill],FILTER(ALL(Table[Company]),Table[Company]="F")) return [Annual Bill] - f

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

here's the pseudo code for the measure. Adjust as needed. Basically eliminate the company from the filter context to find the F value.

 

Diff =

var f = calculate (sum (bill), filter(allexcept(table,company),company="F"))

return sum(bill)-f

Anonymous
Not applicable

Thank you. I was able to solve by doing a slight change in the DAX. Using below DAX I was able to get the desired result.

 

Diff = var f = CALCULATE([Annual Bill],FILTER(ALL(Table[Company]),Table[Company]="F")) return [Annual Bill] - f

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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