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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

@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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.