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
Anonymous
Not applicable

Data Source name used for a date in a line chart

Morning and merry xmas to you all 🙂

 

I have a series of folder named by the date they are created in

 

Inside each folder i have a text file that act a smy data source.

I want to use the folder name to act as the date to create a line chart is there any chance i can do that?

 

Thanks a lot

1 ACCEPTED SOLUTION

PFB solution. Hope this helps. This will extract Data from all the excel sheets dynamically and will add date (sheet Name) as new column. You can copy the entire code or Just copy first two lines and perform any modifications.

 

let
    FullFilePath = "C:\New folder (2)\Moscow Revit Server Data.xlsx",
    Source = Excel.Workbook(File.Contents(FullFilePath)),
    #"Removed Columns" = Table.RemoveColumns(Source,{"Item", "Kind", "Hidden"}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Removed Columns", "Data", {"Column1", "Column2", "Column3"}, {"Data.Column1", "Data.Column2", "Data.Column3"}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Expanded Data", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"2018-09-14", type date}, {"File Name", type text}, {"Model Size MB ", type any}, {"Support Size MB ", type any}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"2018-09-14", "Date"}}),
    #"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each [#"Model Size MB "] <> "Model Size MB ")
in
    #"Filtered Rows"

View solution in original post

6 REPLIES 6
AnkitBI
Solution Sage
Solution Sage

Would have been better If you have provided folder structure and sample data. Based on your description, I have come up with below. Created a Main Folder and two Subfolder with name as DATE, containing text files.

 

To get folder name, trick it to extract it during exisitng functionality of extracting data from Folders using Combine and Edit. Once your data is extracted , go to Removed Other Columns1 step, Open Source and select Folder Path. This way your subfolder names will be added to final query. Then you can perform simple operations like Split to get Date.

 

 

Capture.PNG

 

Capture.PNG1.PNG

 

 

 

Anonymous
Not applicable

I should have included dataset sorry about that.

I did some modifications here, changed to Excel and the tab name is the data.

 

https://www.dropbox.com/s/2mjtv2371u6nz5c/Liste_rspa-moscow_2018-09-01.xlsx?dl=0

https://www.dropbox.com/s/shsy0vungritsjx/Liste_rspa-moscow_2018-10-05.xlsx?dl=0

 

Apologies, I didn't get the shared dataset. Files provided are excels only, Is Date your Folder Name and the File Name are the files present in Folder. If yes, then the previous solution provided shall work. Please give it a try.

 

File NameModel Size MB Support Size MB Date
VAC_A_00.rvt506.78181.229/1/2018
VAC_A_Auditorium.rvt1411.3137.939/1/2018
VAC_A_BR_Arch.rvt198.5217.229/1/2018
Anonymous
Not applicable

My bad as i keep working on it.

Here's a more factual dataset. I ended up putting all the data in the same Excel file with the Tab Name being the date.

https://www.dropbox.com/s/uy3cjompnqe3mpq/Moscow%20Revit%20Server%20Data.xlsx?dl=0

 

The final required result would be to be able to "follow" the File Size trend (for each file) through the "Date" which are the Tab name in a Line Chart.

 

Thanks a lot for your help on this day 🙂

PFB solution. Hope this helps. This will extract Data from all the excel sheets dynamically and will add date (sheet Name) as new column. You can copy the entire code or Just copy first two lines and perform any modifications.

 

let
    FullFilePath = "C:\New folder (2)\Moscow Revit Server Data.xlsx",
    Source = Excel.Workbook(File.Contents(FullFilePath)),
    #"Removed Columns" = Table.RemoveColumns(Source,{"Item", "Kind", "Hidden"}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Removed Columns", "Data", {"Column1", "Column2", "Column3"}, {"Data.Column1", "Data.Column2", "Data.Column3"}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Expanded Data", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"2018-09-14", type date}, {"File Name", type text}, {"Model Size MB ", type any}, {"Support Size MB ", type any}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"2018-09-14", "Date"}}),
    #"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each [#"Model Size MB "] <> "Model Size MB ")
in
    #"Filtered Rows"

@Anonymous Please mark it as solution if response resolved your issue.

 

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.