Skip to main content
cancel
Showing results for 
Search instead 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

Reply
Anonymous
Not applicable

Assign unique identifiers based on multiple criteria within a transactional data set

Hello, 

 

I have a set of data that describes case work coming into a support organization, including who owns it during different points over the case lifecycle. What I need to do is describe each case as having been owned by a group, i.e.  'Red', 'Blue' or 'Red&Blue', based on the Team that shows up in the ownership history. I have a separate table maps the Teams to their group, something like the following:

 

Team A = Red

Team B = Blue

(In reality, I have many more Team combinations, but just trying to keep it simple to get the logic)

 

Tables:

Case[Case]

User[Team]

History[Time]

 

Case      Team       Time

123        A             11:23

123        B             12:34

123        A             12:54

456        B              1:50

456        B              1:56

789        A              10:21

234        A              7:45

234        A              7:52

234        B              7:59

 

I'd like to produce a table that includes the following:

 

Case      Group

123        Red&Blue

456        Blue

789        Red

234        Red&Blue

 

I intend to use the output against other attributes within the Case table, so whether it actually needs to be a table or a measure may be immaterial(?). Any help is appreciated - thank you in advance. 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Based on my understanding, I created two sample tables.

 

Test_1

1.PNG    

 

Test_2

2.PNG

 

To get desired output, please new a calculated table with this DAX formula:

Test_3 =
SUMMARIZE (
    ADDCOLUMNS (
        SUMMARIZE ( Test_1, Test_1[Case], Test_2[Team] ),
        "Group", LOOKUPVALUE ( Test_2[Group], Test_2[Team], [Team] )
    ),
    [Case],
    "Group2", CONCATENATEX (
        ADDCOLUMNS (
            SUMMARIZE ( Test_1, Test_1[Case], Test_2[Team] ),
            "Group", LOOKUPVALUE ( Test_2[Group], Test_2[Team], [Team] )
        ),
        [Group],
        "&"
    )
)

3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Based on my understanding, I created two sample tables.

 

Test_1

1.PNG    

 

Test_2

2.PNG

 

To get desired output, please new a calculated table with this DAX formula:

Test_3 =
SUMMARIZE (
    ADDCOLUMNS (
        SUMMARIZE ( Test_1, Test_1[Case], Test_2[Team] ),
        "Group", LOOKUPVALUE ( Test_2[Group], Test_2[Team], [Team] )
    ),
    [Case],
    "Group2", CONCATENATEX (
        ADDCOLUMNS (
            SUMMARIZE ( Test_1, Test_1[Case], Test_2[Team] ),
            "Group", LOOKUPVALUE ( Test_2[Group], Test_2[Team], [Team] )
        ),
        [Group],
        "&"
    )
)

3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ImkeF
Super User
Super User

1) Create a lookup table with column "TeamKey" (containing A, B...) and another column "TeamName" (Red, Blue...)

2) Merge your main table with the lookup table and expand "TeamName"

3) Group on "Case" and choose "All" as aggregation with default-name "Count"

4) Add a column where you create your text string dynamically: Text.Combine([Count][TeamName], "& ")

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors