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
bvdm1980
Helper II
Helper II

wrong returned data when combining tables in a measure

bvdm1980_0-1716972345035.png

 

So please have a look at the printscreen of partial table. I made this table to check the data, and ofcourse it shows that my budget amount isnt correct. 

I have 1 table with dim_purchase_actions (not unique numbers...), but my purchase action # in print comes from my purchase order table (as otherwise it shows error in data).

So the first 4 colums all come from my fact purchase order detail table. The last colum comes from my fact budget detail table. 

 

What i need is per project (not necessarily per purchase action/order):
purchase budget amount -/- purchase order amount -/- risk reservation amount = purchase order result

 

i made a key in 3 tables being project # + purchase action #, making this unique values. Using this key, doesn't return correct data. 
But whichever formula i try (sumx, or calculate with filter etc), i cant get the right purchase order result.

 

Where am i forgetting something or doing stuff wrong? Its getting so frustating not being able to do simple stuff like this. 

I made another measure filtering budget, resulting in measure "budget op inkoopactie". 

 

So if you deduct 28.345+789 from 28.145 you have the correct result. But i cant get it in a measure that shows that amount...

bvdm1980_1-1716973022881.png

 

My purchase order result formula now looks like this:

purchase order result =
CALCULATE(
    SUM(fact_purchaseorderdetail[amount]) + SUM(fact_purchaseorderdetail[risk reservation])  - [Budget op inkoopactie],
   FILTER(fact_purchaseorderheader, fact_purchaseorderheader[Order status] = "approved"))
 
and this returns 24m result where it should be -/-988k
 
if some stuff aint clear, let me know. Thanks for the help in advance!
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@bvdm1980 

Here are our solutions based on our understanding of your needs:
1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1717047384855.png

vlinyulumsft_1-1717047408164.png

vlinyulumsft_2-1717047428825.png

2.I created the following table link:

vlinyulumsft_3-1717047451489.png

3. Below are the measure I've created for your needs:

urchase order result = 
CALCULATE(
    SUM(budget[Budget amount])-SUM('detail'[Purchase order line amount]) - MAX('detail'[Risk reservation]),
   FILTER('order', 'order'[stauts] = "approved"))

4.Here's my final result, which I hope meets your requirements.

vlinyulumsft_4-1717047502403.png

 

5.If the above options don't work, you can use the Allselected() function or the All() function in the FILTER() function:

FILTER(ALLSELECTED('order'), 'order'[stauts] = "approved"))
FILTER(ALL ('order'), 'order'[stauts] = "approved"))

The following is the relevant documentation:

ALLSELECTED function (DAX) - DAX | Microsoft Learn

ALL function (DAX) - DAX | Microsoft Learn
Or check if your table relationships are affecting your results, and the meassure you are quoting.

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Please find the attached pbix relevant to the case.

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi,@bvdm1980 

Here are our solutions based on our understanding of your needs:
1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1717047384855.png

vlinyulumsft_1-1717047408164.png

vlinyulumsft_2-1717047428825.png

2.I created the following table link:

vlinyulumsft_3-1717047451489.png

3. Below are the measure I've created for your needs:

urchase order result = 
CALCULATE(
    SUM(budget[Budget amount])-SUM('detail'[Purchase order line amount]) - MAX('detail'[Risk reservation]),
   FILTER('order', 'order'[stauts] = "approved"))

4.Here's my final result, which I hope meets your requirements.

vlinyulumsft_4-1717047502403.png

 

5.If the above options don't work, you can use the Allselected() function or the All() function in the FILTER() function:

FILTER(ALLSELECTED('order'), 'order'[stauts] = "approved"))
FILTER(ALL ('order'), 'order'[stauts] = "approved"))

The following is the relevant documentation:

ALLSELECTED function (DAX) - DAX | Microsoft Learn

ALL function (DAX) - DAX | Microsoft Learn
Or check if your table relationships are affecting your results, and the meassure you are quoting.

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Please find the attached pbix relevant to the case.

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

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.