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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Ssmit
Frequent Visitor

Creating a new table based on multiple factors

Greetings,

I'm still quite new to PowerBI and I've had the luck of pretty much finding information about everything I needed.

However; my issue is as follows:

I need to create a new table based on multiple factors.

First being I need to select the earliest possible ticket based on the earliest action date/time(activityTime) that is known.
Second I need to filter the above by checking if the timeDifference is bigger than the priorityTime and only display the tickets that meet both of the above factors.

companyNametitleticketNumbercTimeactivityTimepriorityLevelpriorityTimeuserFullnamestatusNiveautypeIdLeveltimeDifference
           
xtest1017-04-2018 09:23:3918-04-2018 09:04:15Low24:00:00xOpenMalfunction08:40
xtest916-04-2018 16:12:3116-04-2018 17:02:29Low24:00:00xOpenMalfunction00:49
xtest820-02-2018 14:28:3320-02-2018 14:44:07Low24:00:00xActiveMalfunction00:15
xtest820-02-2018 14:28:3320-02-2018 15:12:22Low24:00:00xActiveMalfunction00:43
xtest820-02-2018 14:28:3320-02-2018 15:58:13Low24:00:00xActiveMalfunction01:29
xtest820-02-2018 14:28:3321-02-2018 10:05:54Low24:00:00xActiveMalfunction04:37
xtest714-02-2018 13:32:2921-02-2018 13:41:36Average08:00:00xActiveMalfunction46:09
xtest714-02-2018 13:32:2921-02-2018 16:28:56Average08:00:00xActiveMalfunction75:56
xtest607-03-2017 09:28:2807-03-2017 11:32:00High02:00:00xActiveMalfunction02:04
xtest607-03-2017 09:28:2807-03-2017 14:24:31High02:00:00xActiveMalfunction04:56
xtest528-09-2016 17:17:4018-04-2018 09:04:15Low24:00:00xActiveMalfunction2546:55
xtest528-09-2016 17:17:4018-04-2018 09:10:15Low24:00:00xActiveMalfunction2556:55
xtest428-12-2015 15:23:4318-04-2018 09:04:15Average08:00:00xActiveMalfunction5285:40
xtest428-12-2015 15:23:4318-04-2018 09:10:15Average08:00:00xActiveMalfunction5291:40
xtest323-11-2015 09:15:0023-11-2015 09:15:00Urgent01:00:00xOpenMalfunction00:00
xtest222-11-2015 08:30:0022-11-2015 10:30:00Urgent01:00:00xOpenMalfunction02:00
xtest121-11-2015 09:30:0021-11-2015 10:30:00High02:00:00xActiveMalfunction01:00

 

What is shown above is the current test data and what is shown below is what the new table should look like based on the two factors but I have absolutely no clue where to start with this

 

xtest714-02-2018 13:32:2921-02-2018 13:41:36Average08:00:00xActiveMalfunction46:09
xtest607-03-2017 09:28:2807-03-2017 11:32:00High02:00:00xActiveMalfunction02:04
xtest528-09-2016 17:17:4018-04-2018 09:04:15Low24:00:00xActiveMalfunction2546:55
xtest428-12-2015 15:23:4318-04-2018 09:04:15Average08:00:00xActiveMalfunction5285:40
xtest222-11-2015 08:30:0022-11-2015 10:30:00Urgent01:00:00xOpenMalfunction02:00

 

A massive thank you to whomever is able to help, even if it's just a little bit!

1 ACCEPTED SOLUTION
Ssmit
Frequent Visitor

Happened to find a new source that allowed me to achieve what I needed to achieve:
https://community.powerbi.com/t5/Desktop/Filter-Query-or-create-new-table-based-on-first-date-duplic...

Solution:

Table2 =
VAR T1 = SUMMARIZE('Table1'[TicketNumber];"First action"; MIN('Table1'[ActivityTime]))
VAR T2 = FILTER(NATURALINNERJOIN('Table1';T1); 'Table1'[TimeDifference] > 'Table1'[PriorityTimes])
RETURN T2

 

Thanks v-yuta-msft for trying to help, you did put me on the right track!

View solution in original post

4 REPLIES 4
v-yuta-msft
Community Support
Community Support

Hi Ssmit,

 

Try DAX formula below:

new table =
FILTER (
    table,
    table[activityTime] = MIN ( table[activityTime] )
        && tabel[timeDifference] > table[priorityTime]
)

 

Regards,

Jimmy Tao

Hello Jimmy,

 

Unfortunately this returns an empty table.

I think the reason for this is the way I put together the priorityTime and TimeDifference.

Both are in text format because I wanted both of them to show the full time value instead of starting over when the time goes past 23:59. I'm using CONCATENATE and TRUNC to piece them together.

Ssmit
Frequent Visitor

Decided to keep playing around with it for a bit after I was done with some other stuff I had to do today.

 

timeDifference > priorityTime works just fine, I'm guessing that the other part of the filter Jimmy suggested somehow didn't get picked up when making the new table

Ssmit
Frequent Visitor

Happened to find a new source that allowed me to achieve what I needed to achieve:
https://community.powerbi.com/t5/Desktop/Filter-Query-or-create-new-table-based-on-first-date-duplic...

Solution:

Table2 =
VAR T1 = SUMMARIZE('Table1'[TicketNumber];"First action"; MIN('Table1'[ActivityTime]))
VAR T2 = FILTER(NATURALINNERJOIN('Table1';T1); 'Table1'[TimeDifference] > 'Table1'[PriorityTimes])
RETURN T2

 

Thanks v-yuta-msft for trying to help, you did put me on the right track!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.