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

Filtering based on the earliest known activityTime date per ticket

Dear all,

I'm trying to filter through tickets and I wanted to display the tickets where the activityTime is the earliest value and filter out everything else that has the same ticketNumber.

What the data currently looks like:

ticketNumbercreationTimeactivityTimepriorityLevelpriorityTimestatusNiveautypeIdLeveltimeDifference
714-02-2018 13:32:2921-02-2018 13:41:36Average08:00:00ActiveMalfunction46:09
714-02-2018 13:32:2921-02-2018 16:28:56Average08:00:00ActiveMalfunction75:56
607-03-2017 09:28:2807-03-2017 11:32:00High02:00:00ActiveMalfunction02:04
607-03-2017 09:28:2807-03-2017 14:24:31High02:00:00ActiveMalfunction04:56
528-09-2016 17:17:4018-04-2018 09:04:15Low24:00:00ActiveMalfunction2546:55
528-09-2016 17:17:4018-04-2018 09:10:15Low24:00:00ActiveMalfunction2556:55
428-12-2015 15:23:4318-04-2018 09:04:15Average08:00:00ActiveMalfunction5285:40
428-12-2015 15:23:4318-04-2018 09:10:15Average08:00:00ActiveMalfunction5291:40
222-11-2015 08:30:0022-11-2015 10:30:00Urgent01:00:00OpenMalfunction02:00

 

What I want it to look like:

ticketNumbercreationTimeactivityTimepriorityLevelpriorityTimestatusNiveautypeIdLeveltimeDifference
714-02-2018 13:32:2921-02-2018 13:41:36Average08:00:00ActiveMalfunction46:09
607-03-2017 09:28:2807-03-2017 11:32:00High02:00:00ActiveMalfunction02:04
528-09-2016 17:17:4018-04-2018 09:04:15Low24:00:00ActiveMalfunction2546:55
428-12-2015 15:23:4318-04-2018 09:04:15Average08:00:00ActiveMalfunction5285:40
222-11-2015 08:30:0022-11-2015 10:30:00Urgent01:00:00OpenMalfunction02:00

 

As you can see in the second table it only shows the tickets where the activityTime is the earliest.

What I've tried so far:
table2 =
VAR T1 = FILTER('table1';
'table1'[timeDifference] > 'table1'[priorityTimes]
&&
'table1'[TypeIdLevel] = "Malfunction"
&&
'table1'[activityTime] = MIN('table1'[activityTime]))
RETURN T1

 

In the formula that is displayed above you can see that I have already applied some filters. That last part however returns an empty table because it only collects the ticket where the activityTime is the absolute lowest value (which happens to be a ticket of a different typeIdLevel).

Is there another way to accomplish what I want to accomplish?

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

HI @Ssmit

 

Try this calculated Table

 

New Table =
VAR tickets =
    SELECTCOLUMNS (
        VALUES ( Table1[ticketNumber] ),
        "Ticket_Number", [ticketNumber]
    )
RETURN
    GENERATE (
        tickets,
        CALCULATETABLE ( TOPN ( 1, Table1, Table1[activityTime], ASC ) )
    )

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

HI @Ssmit

 

Try this calculated Table

 

New Table =
VAR tickets =
    SELECTCOLUMNS (
        VALUES ( Table1[ticketNumber] ),
        "Ticket_Number", [ticketNumber]
    )
RETURN
    GENERATE (
        tickets,
        CALCULATETABLE ( TOPN ( 1, Table1, Table1[activityTime], ASC ) )
    )

Regards
Zubair

Please try my custom visuals

@Ssmit

 

Please see file attached

 

filteringbased.png


Regards
Zubair

Please try my custom visuals

Zubair_Muhammad,

 

Thank you, this does exactly what I need it to do!

 

much appreciated!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

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.