Forum Discussion
Filename as Measure
At the top of my dashboard, i would like to have a label that captures the name of the file only.... not the path. the path is something like this:
https://Jobplace.sharepoint.com/sites/sharepoint/Manpower%20Reports/filename.xlsx
I believe i can create a measure, but im not sure what i need to place in the code (DAX or Power Query Editor) to get the source filename. This will be a template so anytime someone uses this template with ANY file saved on a SP site(s), (same format/data structure but located in different SP websites), i would like to chop off the full path length, but just capture the filename. Can someone tell me how to do this AND the code needed for the measure to make it work?
2 Replies
- mahoneypatMicrosoft Employee
It is easier to do this in the query editor with Text.AfterDelimiter.
But if you do need to do it in DAX, here is one way to do it in a measure.
JustFile =
VAR filepath =
MIN( FileName[FileName] )
VAR sub =
SUBSTITUTE( filepath, "/", "|" )
RETURN
PATHITEMREVERSE( sub, 1 )Pat
- AnonymousNot applicable
sorry for just now getting back to you on this..... i tried to copy and paste the DAX code and its throwing an error around
JustFile =
VAR filepath =
MIN( FileName[FileName] )
VAR sub =
SUBSTITUTE( filepath, "/", "|" )
RETURN
PATHITEMREVERSE( sub, 1 )not sure what im doing wrong here? i dont have a column for the filename. the table name is ManpowerTable. not sure what i need to do......