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.
Hello
First of i am nwe to power BI, tried to search, but could not find a solution.
I am running a direct query on a SQL.
In my database there is a file path colum. But in my slicer i Power BI i want to only show the file name. Is it possible ?
The file path looks like this:
\\ARNE01\project\023\File453\Filename.doc
\\ARNE44\project\554\File324\Filename02.doc
In my slicer i woul like to only show:
Filename.doc
Filemane02.doc
Basiclly want to filter all left of the last \
Hope someone can help, thanks
/Spock
Solved! Go to Solution.
if you weren't using Direct Query I would suggest solving this in M, but I think it's unlikely to work in this case
In DAX you can create measure like this
Filename = MID(Table1[FileName],30,50)
it assumes that the folder path always has 30 characters
This is more flexible, but less performant
Filename = TRIM ( RIGHT ( SUBSTITUTE ( Table1[Filepath], "\", REPT ( " ", LEN ( Table1[Filepath] ) ) ), LEN ( Table1[Filepath] ) ) )
most performant may be just adding the filename in your SQL source though
EDIT the second code will not work if the filenames have spaces in them
if you weren't using Direct Query I would suggest solving this in M, but I think it's unlikely to work in this case
In DAX you can create measure like this
Filename = MID(Table1[FileName],30,50)
it assumes that the folder path always has 30 characters
This is more flexible, but less performant
Filename = TRIM ( RIGHT ( SUBSTITUTE ( Table1[Filepath], "\", REPT ( " ", LEN ( Table1[Filepath] ) ) ), LEN ( Table1[Filepath] ) ) )
most performant may be just adding the filename in your SQL source though
EDIT the second code will not work if the filenames have spaces in them
2. option worked perfekt.
Thanks a lot.
Will keep an eye on performance.
/Spock
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |