Forum Discussion

mmills2018's avatar
mmills2018
Helper IV
4 years ago
Solved

Min value with duplicate unique IDs

Hello,

 

I have two data sources.  My main data source does not have duplicate case numbers.  My other data source does have duplicate case numbers.  I wanted to pull the minimum value from my data source that has duplicates values to my main data sources.

 

Below is my duplicate data source. Ex: i want to take HR Case ID 1002 and bring the min value of 1 into my main data source by HR Case ID.

HR CASE IDConclusion
10023
10022
10021
10032
10033
10041
10042
10043
10044
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi mmills2018,

    What type of calculating expressions are you wanted? Measure or calculated column? Please check the below formulas if they help:

    Measure:

    Measure =
    CALCULATE ( MIN ( Table[Conclusion] ), VALUES ( Table[HR CASE ID] ) )

    Calculated column:

    Column =
    MINX (
        FILTER ( Table, [HR CASE ID] = EARLIER ( Table[HR CASE ID] ) ),
        Table[Conclusion]
    )

    Regards,

    Xiaoxin Sheng

2 Replies

  • mmills2018 add a column in your main table:

     

    Column = 
    VAR __table = RELATEDTABLE ( "DuplicateValueTable" )
    RETURN
    MINX ( __table, [Conclusion] )

     

    assuming these two tables have a relationship on Case ID which will be one to many.

     

    Follow us on LinkedIn

     

    Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi mmills2018,

    What type of calculating expressions are you wanted? Measure or calculated column? Please check the below formulas if they help:

    Measure:

    Measure =
    CALCULATE ( MIN ( Table[Conclusion] ), VALUES ( Table[HR CASE ID] ) )

    Calculated column:

    Column =
    MINX (
        FILTER ( Table, [HR CASE ID] = EARLIER ( Table[HR CASE ID] ) ),
        Table[Conclusion]
    )

    Regards,

    Xiaoxin Sheng