cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## wrong returned data when combining tables in a measure

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...

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],

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
Community Support

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:

2.I created the following table link:

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.

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.

Community Support

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:

2.I created the following table link:

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.

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.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.