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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
obriaincian
Resolver I
Resolver I

How to import excel creation date from sharepoint into data table in Power BI

Hi,

 

I have an excel sheet in sharepoint that I want to import into power bi, I would also like to create a column once it's imported to store the date the file was created.

 

I have several steps in power query to filter for the correct excel.

 

The creation date of the file can be seen in the "Filtered Rows 2" below, is there a way I can create a new step after the "Added Custom" Step to add the this date to the data table?

 

obriaincian_0-1676635616857.png

 

 

Thanks

 

 

 

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @obriaincian 

You can add a custom column using the Custom Column dialog box, where the expression to use for the column references the "Filtered Rows2" step, Date Created column first row.

The formula to enter in the dialog box would be:

= #"Filtered Rows2"[Date created]{0}

 

The code in the formula bar would be something like this:

= Table.AddColumn(#"Added Custom", "Date created", each #"Filtered Rows2"[Date created]{0}, type datetime)

Here's a screenshot from a test query I created:

OwenAuger_0-1676636628208.png

Does this work?

Regards,


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

3 REPLIES 3
obriaincian
Resolver I
Resolver I

@OwenAuger thank you for the above, I am having an issue however, when I try to create a custom column the page just stays on the loading phase and the column never gets created.

No problem, and sorry to hear that there seems to be a performance issue when adding this step.

 

One thing you could try:

1. Select the "Filtered Rows2" step

2. Edit the M code in the formula bar by wrapping it in Table.Buffer( ... 😞

= Table.Buffer ( Table.SelectRows(#"Filtered Rows1", let latest = List.Max(#"Filtered Rows1"[Date created]) in each [Date created] = latest) )

3. Then add the "Date created" column as described earlier.

 

The idea her is to buffer the step that contains "Date created". This should prevent the query re-querying SharePoint just to fetch that date.

Does this work any better?

 

Another option would be to modify the steps of your query so that the "Date created" column remains in the table from step "Filtered Rows2" onwards, but you would need to tweak the steps transforming the Excel file. If you want to try that, could you post your entire M code here (if possible)?

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn
OwenAuger
Super User
Super User

Hi @obriaincian 

You can add a custom column using the Custom Column dialog box, where the expression to use for the column references the "Filtered Rows2" step, Date Created column first row.

The formula to enter in the dialog box would be:

= #"Filtered Rows2"[Date created]{0}

 

The code in the formula bar would be something like this:

= Table.AddColumn(#"Added Custom", "Date created", each #"Filtered Rows2"[Date created]{0}, type datetime)

Here's a screenshot from a test query I created:

OwenAuger_0-1676636628208.png

Does this work?

Regards,


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.