Best way to query and output list from SharePoint list

harleyvrodred

New Member
Joined
Nov 15, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have a couple of SharePoint lists/tables I need to query and output a file or printout. I'm not sure if this can be done in Sharepoint or one of the Microsoft Apps. I'm just thinking exporting it to Excel and doing it there but they need to do this on a regular basis.

Aside from page output formatting there need to be a formula to determine the Status (Current/Expired). If they are a lifetime member, then they will always be current. Otherwise, they need to renew yearly to not be in an expired state.

Thoughts?
-Tim


Members:
Last NameFirst NameMember IDEmailLifetime Member
SmithJohn222JohnSmith@me.comNo
ArmoldPaul456PaulArnold@you.comYes
MurphyJack9263JackMurphy@xx.com
LoweRebeka37989RebLowe@some.netno

Bank:
DateAmountMember IDDescription
7/20/202210.00222Renewal
7/20/202215.00456New
7/20/202210.009263Renewal
11/20/202015.0037989New
7/19/202115.00222New
4/2/201915.009263New

What I'd like for an output would be something like:

Arnold, Paul Email: JohnSmith@me.com Status: Current
7/20/2022 $10.00 Renewal
4/2/2019 $15.00 New
Lowe, Rebeka Email: RebLowe@some.net Status: Expired
11/20/2020 $15.00 New
Murphy, Jack Email: JackMurphy@xx.com Status: Current
7/20/2022 $10.00 Renewal
4/2/2019 $15.00 New
Smith, John Email: JohnSmith@me.com Status: Expired
7/20/2022 $10.00 Renewal
7/19/2021 $15.00 New
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I'm thinking Power Query here. If I'm not mistaken it can connect to a SP list and fetch the data.
Not sure what tables on SP look like. Are those webparts widgets on a page? It might work to use the website connection, but I never tried that.
If that works you can combine the data from both sources in PQ and you would have a refreshable solution in place.
 
Upvote 0
You're right in that Power Query is the way to go.
tblMembers
Book1
ABCDE
1Last NameFirst NameMember IDEmailLifetime Member
2SmithJohn222JohnSmith@me.comNo
3ArmoldPaul456PaulArnold@you.comYes
4MurphyJack9263JackMurphy@xx.com
5LoweRebeka37989RebLowe@some.netno
Sheet1

tblMembers Query
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="tblMembers"]}[Content],
    ChangedType = Table.TransformColumnTypes(Source,{{"Last Name", type text}, {"First Name", type text}, {"Member ID", Int64.Type}, {"Email", type text}, {"Lifetime Member", type text}}),
    MergedColumns = Table.CombineColumns(ChangedType,{"Last Name", "First Name"},Combiner.CombineTextByDelimiter(", ", QuoteStyle.None),"Name"),
    ReorderedColumns = Table.ReorderColumns(MergedColumns,{"Name", "Email", "Member ID", "Lifetime Member"})
in
    ReorderedColumns

tblBank
Book1
GHIJ
1DateAmountMember IDDescription
207/20/202210222Renewal
307/20/202215456New
407/20/2022109263Renewal
511/20/20201537989New
607/19/202115222New
704/02/2019159263New
Sheet1

tblBank Query
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="tblBank"]}[Content],
    ChangedType = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Amount", Int64.Type}, {"Member ID", Int64.Type}, {"Description", type text}}),
    SortedRowsByDate = Table.Sort(ChangedType,{{"Date", Order.Descending}}),
    RemovedOlderDuplicates = Table.Distinct(SortedRowsByDate, {"Member ID"})
in
    RemovedOlderDuplicates
MergedReport
Book1
LMNOPQR
1NameEmailMember IDLifetime MemberDateAmountDescription
2Smith, JohnJohnSmith@me.com222No07/20/202210Renewal
3Armold, PaulPaulArnold@you.com456Yes07/20/202215New
4Murphy, JackJackMurphy@xx.com926307/20/202210Renewal
5Lowe, RebekaRebLowe@some.net37989no11/20/202015New
Sheet1

MergedReport Query
Power Query:
let
    Source = Table.NestedJoin(Members, {"Member ID"}, Bank, {"Member ID"}, "Bank", JoinKind.LeftOuter),
    ExpandedBank = Table.ExpandTableColumn(Source, "Bank", {"Date", "Amount", "Description"}, {"Date", "Amount", "Description"})
in
    ExpandedBank
The Merge is Merge as New. Doesn't have to be, it could be the next step in tblMembers Query.
When the Bank table is sorted by date Descending, and then Duplicates are removed, they're removed from the oldest (bottom of the column) up.
Current isn't included because the logic escaped me.
Arnold, Paul is Current with a 7/20/2022 $10.00 Renewal, but
Smith, John is Expired with the same 7/20/2022 $10.00 Renewal. I assume that's a typo.
Explain how someone is Current/Expired.
Please use XL2BB when posting data.
 
Upvote 0
jdellasala, where does SharePoint features in your solution as that's what the thread is about?
 
Upvote 0
jdellasala, where does SharePoint features in your solution as that's what the thread is about?
Oh what a dope I am! I completely forgot about that (obviously).
I haven't had access to SharePoint for over two years, and it's always changing, and different approaches depending on the situation.
Watch this video - it's one of the latest on the subject, presented by an Excellent presenter! Less than 15 minutes.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top