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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mb0307
Responsive Resident
Responsive Resident

Dax calculation- help needed

Hi Team,

I have scenario…

Orders are raised in the 1st ERP system that is EA, then pulled to second ERP system X3 after that sales invoices are raised in x3.

We want to match the discounts and charges which are checked at EA sales order time with invoice discounts, charges etc. At EA Sales Order we have boolean flag for charges, remakes and showroom.

We have to reversal check. I know the correct discount and charge from invoice. But when I am calculating the discount then its not calculating correctly because of Joins.

Relation between EA salesorder and X3 orders is with OrderID, and x3 order and x3 sales with Document number and last invoice number. But not a active relationship. I have used USERELATIONSHIP then also result is not correct.

I tried making a summary table but when I join them I get error of circular dependency.

Can you please suggest , how can I get the correct result of measures Discounts, Remake and showroom. I have attached the test PBIX with data .https://gofile.io/d/akT3eH/edit 

 

Test case, Correct amount of discount for 2021 is -6163, for customer 148099

1 REPLY 1
lbendlin
Super User
Super User

The data model isn't too bad

 

lbendlin_0-1618438009155.png

It looks like the EACustomer table can be eliminated, and it looks like you are missing the "Sales Orders"  dimension.  Once you add that you can remove the inactive relationships between the fact tables, and your measures will start working.

 

Please read up on the usage of TREATAS(), it will come in very handy here.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Kudoed Authors