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
mattyj2009
Helper II
Helper II

Microsoft SQL DirectQuery Pull Only Latest Date from Table

Good Morning,

 

I have a SQL table that is added to every minute.  However I only want to pull the latest status from the SQL database.  We are doing direct query as it is very important that we are able to press the refresh button in Power BI service and get the most up-to-date information.  

 

Here is a sample of the SQL data we're pulling. 

idFullNameCallTransferStatusDescTotalSecondsAvailableTotalSecondsNotSetTotalSecondsOnCallTotalSecondsWrappingUpTotalSecondsOnBreakTotalSecondsDialingOutTotalSecondsBusyTeamNameCurrentDateTime
4392Lynnette Landon  On Call258091646143406954851Team 17/16/19 10:54 AM
4393Denese Ravencraft  Available0000000Team 17/16/19 10:54 AM
4394Magan Bednar  Available366853472194178910702051Team 17/16/19 10:54 AM
4395Alberto Chitty  Available579118637527474601848Team 27/16/19 10:54 AM
4396Belinda Batson  Available354130681063903881778Team 27/16/19 10:54 AM
4397Vern Siddiqui  Available56201704281971060792416Team 27/16/19 10:54 AM
4398Stephen Nakken  Other - Payment1552390199184000Team 37/16/19 10:54 AM
4399Oswaldo Edelman  Available53999000000Team 37/16/19 10:54 AM
4400Joel Fausto  Available602011326189760367691Team 37/16/19 10:54 AM
4401Exie Scroggs  Available0000000Team 17/16/19 10:54 AM
4402Shira Whittier  Other - Special6980000000Team 17/16/19 10:54 AM
4403Eldon Mcentire  Dial Out - Ringing Destination3426303299499003872324Team 17/16/19 10:54 AM
4404Angelique Lanham  Available179154062920855838Team 27/16/19 10:54 AM
4405Vivan Castrejon  Other - Walk-in3068303876587051733Team 27/16/19 10:54 AM
4406Herminia Hemond  Other - Walk-in25036046591000Team 27/16/19 10:54 AM
4407Jacalyn Yokoyama  Not Set129063518718200596Team 37/16/19 10:54 AM
4408Phylis Tolbert  Available25721427127218789564363Team 37/16/19 10:54 AM
4409Kendall Margolis  Available0000000Team 37/16/19 10:54 AM
4410Rene Cryer  Dial Out - Ringing Destination3880519150686404164264Team 17/16/19 10:54 AM
4411Yuette Koepke  Available0000000Team 17/16/19 10:54 AM
4412Vanna Scala  Available15091535396400141516Team 17/16/19 10:54 AM
4413Lynnette Landon  On Call258091646143406954851Team 17/16/19 10:55 AM
4414Denese Ravencraft  Available0000000Team 17/16/19 10:55 AM
4415Magan Bednar  Available366853472194178910702051Team 17/16/19 10:55 AM
4416Alberto Chitty  Available579118637527474601848Team 27/16/19 10:55 AM
4417Belinda Batson  Available354130681063903881778Team 27/16/19 10:55 AM
4418Vern Siddiqui  Other - Special57391704281971060792416Team 27/16/19 10:55 AM
4419Stephen Nakken  Other - Payment1552390199184000Team 37/16/19 10:55 AM
4420Oswaldo Edelman  Available53999000000Team 37/16/19 10:55 AM
4421Joel Fausto  Available602011326189760367691Team 37/16/19 10:55 AM
4422Exie Scroggs  Available0000000Team 17/16/19 10:55 AM
4423Shira Whittier  Other - Special6980000000Team 17/16/19 10:55 AM
4424Eldon Mcentire  Dial Out - Connected3426303299499003872324Team 17/16/19 10:55 AM
4425Angelique Lanham  Available179154062920855838Team 27/16/19 10:55 AM
4426Vivan Castrejon  Other - Walk-in3068303876587051733Team 27/16/19 10:55 AM
4427Herminia Hemond  Other - Walk-in25036046591000Team 27/16/19 10:55 AM
4428Jacalyn Yokoyama  Available129093718718200596Team 37/16/19 10:55 AM
4429Phylis Tolbert  Dial Out - Connected26141427127218789564363Team 37/16/19 10:55 AM
4430Kendall Margolis  Available0000000Team 37/16/19 10:55 AM
4431Rene Cryer  Dial Out - Ringing Destination3880519150686404164264Team 17/16/19 10:55 AM
4432Yuette Koepke  Available0000000Team 17/16/19 10:55 AM
4433Vanna Scala  Available15091535396400141516Team 17/16/19 10:55 AM

 

From the table above I would only care about the status from 7/16/19 10:55AM for each of the agents.

 

I haven't been able to figure out a way to filter out all other rows to get the information I need.  I'm planning on having a table that would show the total number of agents per status and would like to have a card or two that has stuff like average of total seconds available and average of total second busy.

 

Any information to set me on the right track would be appreciated.  Have a great day!!!

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @mattyj2009 

You could try these two ways as below:

1. You could use SQL Queries to Retrieve SQL Server Data, then add a conditional in it

https://www.red-gate.com/simple-talk/sql/bi/power-bi-introduction-working-with-sql-server-data-in-po...

2.  In Edit Queries, add a filter step for this query

11.JPG

 

 

best regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi, @mattyj2009 

You could try these two ways as below:

1. You could use SQL Queries to Retrieve SQL Server Data, then add a conditional in it

https://www.red-gate.com/simple-talk/sql/bi/power-bi-introduction-working-with-sql-server-data-in-po...

2.  In Edit Queries, add a filter step for this query

11.JPG

 

 

best regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

When I attempt to do option 2 I get the a message saying "This table is empty". 

TableEmpty.PNG

 

But I did some tinkering around and I added a new step to set the CurrentDateTime to Date/Time type then did the is latest filter and it worked. 

 

Just thought I would throw that out just in case someone has a similar experience. 

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.