Forum Discussion
AnjanaPothineni
3 years agoFrequent Visitor
How to extract a table name from a query string in DAX
Hi, I have a Power BI report to list all the queries that are ran as part of query auduting and I have a column that contains a query. In order to simplify the data I need to split (extract) the ...
grazitti_sapna
Super User
3 years agoYou can try using this for achieving your desired output.
TableNames =
VAR StartIndex = FIND("[", 'YourTable'[Query], 1)
VAR EndIndex = FIND("]", 'YourTable'[Query], StartIndex)
RETURN
MID('YourTable'[Query], StartIndex, EndIndex - StartIndex + 1)
Hope this will helo you.
- AnjanaPothineni3 years agoFrequent Visitor
Thanks for quick reply. Logic seems to work but my query has all sorts of table referecing is tere like sometimes they used schema with table name with[] and in some its a query with just table name etc. I will refine it further and apply this logic there.