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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Patelnitya
Frequent Visitor

Help with DAX formula

Hello Power BI Users, 

 

I am having trouble solving the below issue. 

 

I have megered two tables - One is a SQL Sales Data from my erp system and the other is an excel costing file

 

My aim is to get:

 

1) Gross Profit per product (Which i have managed to create a new column and calculate) works accurately: 1-Product GP = vwNityaSalesView2[1-Ave.P]-vwNityaSalesView2[1-Cost Aug 16']

 

2) Total Gross Profit - I am having Problems with this one: I have tried the following formula "1-Total GP = vwNityaSalesView2[1-Product GP]*vwNityaSalesView2[QtySold]"  but i get an error "A circular dependency was detected: vwNityaSalesView2[1-Product GP], vwNityaSalesView2[1-Total GP], vwNityaSalesView2[1-Product GP]."

 

Attached images for better understanding. 

Gross Profit per Product.jpg

 

Kind Regards, 

Nitya

Total Gross Profit.JPG

6 REPLIES 6
Eric_Zhang
Microsoft Employee
Microsoft Employee

@Patelnitya

 

I don't get the circular dependency problem when trying to add those two columns following the snapshot. Can you upload the pbix for further troubleshooting?

Hello All, 

 

Pls find data sample in the below link for your better understanding of the problem. 

 

https://www.dropbox.com/s/ldx691r9xzkyx58/Papa%20Sep%202016%20-%20Vr1%20-%20Copy.pbix?dl=0

 

Thanks, 

Nitya 

@Patelnitya

 

Try to change the [1-Ave.P] to

 

 

1-Ave.P =
SUMX ( ALL ( vwNityaSalesView2 ), vwNityaSalesView2[Value Excl] )
    / SUMX ( ALL ( vwNityaSalesView2 ), vwNityaSalesView2[QtySold] )

Then the cricular error in below calculated column shoud go away.

 

 

1-Total GP = vwNityaSalesView2[1-Product GP]*vwNityaSalesView2[QtySold]

 

 

Or keep the measure [1-Ave.P] as it is, change

 

1-Product GP =
SUMX ( ALL ( vwNityaSalesView2 ), vwNityaSalesView2[Value Excl] )
    / SUMX ( ALL ( vwNityaSalesView2 ), vwNityaSalesView2[QtySold] )
    - vwNityaSalesView2[1-Cost Aug 16']

 

 

Check Understanding Circular Dependencies.

Hello Eric, 

 

I am still having some DAX formulations with your proposed solutions. 

 

Attached are some screen shots of what you proposed. Notice that Ave Price is the same throughout all rows and on the second option the calculations are not correct . 

 

Ave Price - same to all rows.JPGWrong Total GP and Wrong Product GP.JPG

BhaveshPatel
Community Champion
Community Champion

Hi Nitya,

 

Have you tried SUMX that I suggested you before.

 

Thanks & Regards,

Bhavesh

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Hi Bhavesh, 

 

I did try SUMX. However the figures are not coming correct. See below screen shot. e.g. Product Code K007. I think the issue is that 1-Product GP is Average. 

 

Any ideas to solving this. 

 

rgds

 

1Measure-DAX-SUMX.JPG

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.