Forum Discussion

jason5703's avatar
jason5703
Icon for Helper I rankHelper I
5 years ago
Solved

Need to build a smart sub-table

This is probably pretty easy to figure out I just have come up with blanks on both how to accomplish and how to search.  I need to create a subtable of distinct id's from a table that contains those id's with multiple characteristics and if one of those characteristics is not matched the subtable will tell me that.  Rudimentary example below.

IDCHAR_SYS_1CHAR_SYS_2SYSTEM MATCH
1000NNMATCHED
1000BATTBATTMATCHED
1000100100MATCHED
100010/11/201910/11/2019MATCHED
1001NNMATCHED
1001BATTBATTMATCHED
1001201201MATCHED
100109/20/201902/03/2018NOT MATCHED

 

I would want the subtable to look something like this:

IDALL_CHARS_STATUS
1000MATCHED
1001NOT MATCHED

 

 

  • Hi jason5703 ,

     

    Based on your description, create the following measure to get the results you want.

    Measure = CALCULATE(MAX('Table'[SYSTEM MATCH]),ALLEXCEPT('Table','Table'[ID]))

     

     

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

3 Replies

  • HotChilli's avatar
    HotChilli
    Icon for Community Champion rankCommunity Champion

    In Power Query, do a 'Group By' on ID and aggregate on the MAX of SYSTEM_MATCH column.

     

    This works because the N of 'NOT MATCHED' is later in the alphabet than M in 'MATCHED'

    • jason5703's avatar
      jason5703
      Icon for Helper I rankHelper I

      I tried the below and the SYSTEM_MATCH column showed every row to be "NOT MATCHED"

       

      New Table =
      SUMMARIZE (
      ALL (Data[ID],Data[DataSystems]),
      Data[ID],
      "PER_ID_STATUS", MAX(Data[DataSystems])
      )
       
      The Data[DataSystems] column is calculated and not available in PowerQuery
       
      I tried a similar GROUPBY and had the same problem.
  • V-lianl-msft's avatar
    V-lianl-msft
    Icon for Community Support rankCommunity Support

    Hi jason5703 ,

     

    Based on your description, create the following measure to get the results you want.

    Measure = CALCULATE(MAX('Table'[SYSTEM MATCH]),ALLEXCEPT('Table','Table'[ID]))

     

     

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