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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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