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
DK_m
Frequent Visitor

Need to Show Top 2 Aging Tickets by each individual Region in a matrix table

i have a open tickets table and region table. PFB, i need matrix Table as show in the screenshot.

DK_m_0-1707486241412.png

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1707488589126.png

 

 

Jihwan_Kim_0-1707488567460.png

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

Age Top 2 aging: = 
IF (
    HASONEVALUE ( Open_Tickets[Ticket id] ),
    CALCULATE (
        MAX ( Open_Tickets[Age] ),
        KEEPFILTERS (
            WINDOW (
                1,
                ABS,
                2,
                ABS,
                SUMMARIZE (
                    ALL ( Open_Tickets ),
                    Dim_Region[Region],
                    Open_Tickets[Ticket id],
                    Open_Tickets[Date],
                    Open_Tickets[Age]
                ),
                ORDERBY ( Open_Tickets[Date], ASC ),
                ,
                PARTITIONBY ( Dim_Region[Region] )
            )
        )
    )
)

 

Date Top 2 aging: =
IF (
    HASONEVALUE ( Open_Tickets[Ticket id] ),
    CALCULATE (
        MAX ( Open_Tickets[Date] ),
        KEEPFILTERS (
            WINDOW (
                1,
                ABS,
                2,
                ABS,
                SUMMARIZE (
                    ALL ( Open_Tickets ),
                    Dim_Region[Region],
                    Open_Tickets[Ticket id],
                    Open_Tickets[Date],
                    Open_Tickets[Age]
                ),
                ORDERBY ( Open_Tickets[Date], ASC ),
                ,
                PARTITIONBY ( Dim_Region[Region] )
            )
        )
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1707488589126.png

 

 

Jihwan_Kim_0-1707488567460.png

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

Age Top 2 aging: = 
IF (
    HASONEVALUE ( Open_Tickets[Ticket id] ),
    CALCULATE (
        MAX ( Open_Tickets[Age] ),
        KEEPFILTERS (
            WINDOW (
                1,
                ABS,
                2,
                ABS,
                SUMMARIZE (
                    ALL ( Open_Tickets ),
                    Dim_Region[Region],
                    Open_Tickets[Ticket id],
                    Open_Tickets[Date],
                    Open_Tickets[Age]
                ),
                ORDERBY ( Open_Tickets[Date], ASC ),
                ,
                PARTITIONBY ( Dim_Region[Region] )
            )
        )
    )
)

 

Date Top 2 aging: =
IF (
    HASONEVALUE ( Open_Tickets[Ticket id] ),
    CALCULATE (
        MAX ( Open_Tickets[Date] ),
        KEEPFILTERS (
            WINDOW (
                1,
                ABS,
                2,
                ABS,
                SUMMARIZE (
                    ALL ( Open_Tickets ),
                    Dim_Region[Region],
                    Open_Tickets[Ticket id],
                    Open_Tickets[Date],
                    Open_Tickets[Age]
                ),
                ORDERBY ( Open_Tickets[Date], ASC ),
                ,
                PARTITIONBY ( Dim_Region[Region] )
            )
        )
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


@Jihwan_Kim ,

 

Always forget the windows function, great solution.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



MFelix
Super User
Super User

Hi @DK_m ,

 

Create the following measure:

Filter Rows = 

    IF (
        SELECTEDVALUE ( 'Open Tickets'[Ticket ID] )
            IN SELECTCOLUMNS (
               CALCULATETABLE( TOPN (
                    2,
                    ADDCOLUMNS ( ALLSELECTED ( 'Open Tickets' ), "DD", RELATED ( Region[Region] ) ),
                    'Open Tickets'[Age]
                ), Region[Region] in VALUES(Region[Region])),
                "T", 'Open Tickets'[Ticket ID]
            ),
        1
    )
    

Add it has a filter on your visual and select is not blank result below:

MFelix_0-1707488098437.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



DK_m
Frequent Visitor

@MFelix Thanks for the reply & Suggestion

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

April Fabric Community Update

Fabric Community Update - April 2024

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

March 2024 PBI Gallery Image

Power BI Monthly Update - March 2024

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