Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
yuvarajin
Regular Visitor

Grouping the records by having different logics in each field

Here i wanted to do a grouping by EP ID, Requested Date, Request type as one record. As a grouped record each field (other than EP id, Requested Date, Request type ) is having a seperate grouping logics(logic explained below)

 

1. Each line Due date will be grouped, as a result the max due date will be considered as Grouped Due date

2. Last decision field will be grouped based on below logic

         a) If all are "Approved" then grouped result is "Approved"

         b) If all are "Denied" then grouped result is "Denied"

         c) If all are "Partial Denial" then grouped result is "Partial Denial"

         d) If we are having mixed decision at line level then grouped result is "Partial Denial"

3. At line level if all Re-open/any other flag is showing as Y then group result will be Y else N

4. Decision reason should be concatenated and consider all the different reason in one column by coma seperate value.

 

Before grouping:

yuvarajin_0-1670958696596.png

After grouping:

yuvarajin_1-1670958755959.png

pls assist on this grouping.

 

2 REPLIES 2
v-yinliw-msft
Community Support
Community Support

Hi @yuvarajin ,

 

You can try this method:

Create a table:

Result =
SUMMARIZE (
    'Table',
    [EP ID],
    [Request Date],
    'Table'[Request type],
    'Table'[Request Priority],
    "Due Date", MAX ( 'Table'[Due Date] ),
    "Decision Date", MAX ( 'Table'[Decision Date] ),
    "last Decision",
        IF (
            DISTINCTCOUNT ( 'Table'[Last Decision] ) > 1,
            "Partial Denial",
            MAX ( 'Table'[Last Decision] )
        ),
    "Re-open",
        IF (
            CONTAINSSTRING (
                CONCATENATEX ( VALUES ( 'Table'[Re-open(Y/N)] ), [Re-open(Y/N)] ),
                "Y"
            ),
            "Y",
            "N"
        ),
    "Decision reason", CONCATENATEX ( VALUES ( 'Table'[Decision reason] ), [Decision reason], "," )
)

The result is:

vyinliwmsft_0-1671008183381.png

 

Hope these help you.

Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

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

Thanks for the quick response , let me try this one. I was actually looking for the solution in Power Query editor for the solution. Is it possible for you assist the same Power Query editor?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.