Forum Discussion

Mseeram's avatar
Mseeram
Frequent Visitor
4 years ago
Solved

Calculate min based on the selected values

Hello everyone,
I am trying to get the minimum amount based on selecting few subvendors


which I could able to achive it, now I need to create an other table comparing each subvendor with the above target column and get the cost difference and the percentage difference, somthing like below.

 

This should be dynamic, what ever selection I do in the first visual I have to compare the target min value with all the subvendors used in it can some one help me resolve this. I am attaching a sample Pbix and excel that I exported to create the 2nd visual.
https://cscishell-my.sharepoint.com/:u:/g/personal/mseeram_csci_build/EXPvLO5ZX9pOobDcg3d940QBOWo6QaSWCWSN5Vas_rLDqA?e=e9EMmQ

https://cscishell-my.sharepoint.com/:x:/g/personal/mseeram_csci_build/ER9F5DGXy9NIgZ-Ln15TAWgBenVYu8dMb0t6rvjkrcfqtQ?e=jinawU

Thanks,
Murali

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Mseeram ,

     

    I created three measures.

    Target(min) =
    CALCULATE (
        MIN ( 'Sample'[Cost] ),
        FILTER (
            ALL ( 'Sample' ),
            [Item Code] = MAX ( 'Sample'[Item Code] )
                && [Item Desc] = MAX ( 'Sample'[Item Desc] )
        )
    )
    
    Diff = SUM('Sample'[Cost])-[Target(min)]
    Percentage = DIVIDE([Diff],SUM('Sample'[Cost]))

     

     

    Best Regards,

    Stephen Tao

     

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

5 Replies