Forum Discussion

bvdm1980's avatar
bvdm1980
Helper II
2 years ago
Solved

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...
  • Anonymous's avatar
    Anonymous
    2 years ago

    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.