# I have a problem in my dax formula

I show below my current DAX formula which does give my the result i require
I do however wish to calculate Gross Profit , Gross Profit Margin And Net Profit
I have tried several attempts , and also created an "interdependent problem

`Total 000's = VAR Revenue = CALCULATE(SUM('Mateen Combined'[Value]), FILTER('COA Category','COA Category'[MainCat] = "Revenue" )) VAR COGS = CALCULATE(SUM('Mateen Combined'[Value]), FILTER('COA Category','COA Category'[MainCat] = "COGS" )) * -1 VAR OPEX = CALCULATE(SUM('Mateen Combined'[Value]), FILTER('COA Category','COA Category'[MainCat] = "OPEX" )) * -1 VAR Finance = CALCULATE(SUM('Mateen Combined'[Value]), FILTER('COA Category','COA Category'[MainCat] = "Finance" )) * -1 VAR DEPN = CALCULATE(SUM('Mateen Combined'[Value]), FILTER('COA Category','COA Category'[MainCat] = "DEPN" )) * -1 VAR NT = CALCULATE(SUM('Mateen Combined'[Value]), FILTER('COA Category','COA Category'[MainCat] = "NT" )) * -1 RETURN DIVIDE(Revenue +COGS+OPEX+Finance+DEPN+NT,1000,0 )`

Hi

Could you please share the problem or error message you are getting

Thanks

Couple of things first.

It’s very difficult to understand formulas when they are like this.

Really work on formatting them so they are easier to read. I’m not sure if this was the initial formatting by I honestly can’t read it like this.

Also second, it’s quite hard to assist when just looking at a formula. There can always be a lot at play so a demo model is preferable in these situations.

Thirdly, instead of creating numerous variables (VAR) here, I would look to break this done into seperate functions/measures. This way you can see the behaviour of each result.

This is exactly what I do when I’m working in Power BI and then I use measure branching technique to get me end formulas. This can simplify things immensely.

You can always bring everything back into one function after you done the auditing of your results as separate measures.

See how you go with these ideas.

Thanks
Sam