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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
talita19ny
Frequent Visitor

DAX formula to sum amount for specific codes

Hi all, 

 

I'm currently using Dax to calculate amount for specific codes within a table. However when I export the data into excel to compare, I see that there are missing numbers which completely throws off the totals. Examples of the formulas are:

 

Other Deductions (No TN/Fuel/RM) =
CALCULATE(
    SUM('Loan Deductions'[Amount]),'Loan Deductions'[Ded. Code] in
    {"OO-2290DED","OO-2290RTL","OO-AAIC","OO-AALEASE","OO-ACCIDEN","OO-ACCRUED","OO-ADMIN","OO-ADMSRV","OO-ADVANCE","OO-ATBFEE","OO-AUTOLIA","OO-BACKGRD","OO-BADDEBT","OO-BOBTAIL","OO-BONUS","OO-BPLATE","OO-BRAND","OO-C2671","OO-CARINS","OO-CARRFEE","OO-CARRLEA","OO-CHECK","OO-CHECK2","OO-CHECK3","OO-CLINK","OO-CORRECT","OO-D8362","OO-EXCINT","OO-EXPENSE","OO-FEDNTL","OO-FEETRAI","OO-FFOI1","OO-FFOI2","OO-FFPOI","OO-FUELTAX","OO-FXBONUS","OO-GARNISH","OO-GPS","OO-HEALTH","OO-HOLDING","OO-INSBOE","OO-INSGEN","OO-INSLIAB","OO-LEASE","OO-LEASFEE","OO-LLPROG","OO-LREBATE","OO-MACDEP","OO-MACRFEE","OO-MGTFEE","OO-MISC","OO-MISCCRG","OO-MISCFEE","OO-MISCINT","OO-MISCLOA","OO-MISCTRK","OO-MISREIM","OO-MVFUNDS","OO-NAVIGO","OO-OCCUP","OO-OWNEROP","OO-PANDIR","OO-PANINS","OO-PANLNTL","OO-XPODBB"})
 
 
Total R&M =
CALCULATE(
    SUM('Loan Deductions'[Amount]),'Loan Deductions'[Ded. Code] in {"OO-R&M"})
 
 
What confuses me is that for some users I see R&M and past due deductions expenses but I dont see for other users that also should be listed. Is this formula incorrect?
 
talita19ny_0-1669660461305.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@talita19ny , use filter function  and try

Total R&M =
CALCULATE(
SUM('Loan Deductions'[Amount]),filter('Loan Deductions', 'Loan Deductions'[Ded. Code] in {"OO-R&M"}) )

 

and if that works, this is the reason

http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@talita19ny , use filter function  and try

Total R&M =
CALCULATE(
SUM('Loan Deductions'[Amount]),filter('Loan Deductions', 'Loan Deductions'[Ded. Code] in {"OO-R&M"}) )

 

and if that works, this is the reason

http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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