Forum Discussion
Azure Cost Management - Splitting Out Tags
- 6 years ago
Sorry about that, I was using it on some older code.
Find the correct code here:
application =
VAR tag = "application"
VAR textLength =
FIND( ",",
Sheet3[Tags],
FIND(tag,Sheet3[Tags])+LEN(tag)+3)-(FIND(tag,Sheet3[Tags])+LEN(tag)+3)-1
RETURN
MID(
Sheet3[Tags],
FIND(tag,Sheet3[Tags])+LEN(tag)+3,
textLength)I have also added the Variable tag. Now, you simply have to get whatever tag you're looking for and replace "application" with the tag.
This should solve your issue! Please mark this post as the solution to help others! 😁
- Anonymous6 years ago
Hey all,
Not sure if anyone's still having trouble with this, but thought I'd share the method I used to work with tags.
The Tags field in Azure Cost Management is almost JSON format, but is missing the opening and closing curly braces.
By adding these back, I was then able to use Transform -> JSON without error.
Example:
#"Added Custom" = Table.AddColumn(usagedetails, "Tags JSON", each Text.Combine({"{ ", [Tags], " }"})), #"Parsed JSON" = Table.TransformColumns(#"Added Custom",{{"Tags JSON", Json.Document}}),Hope that helps someone!
Sorry about that, I was using it on some older code.
Find the correct code here:
application =
VAR tag = "application"
VAR textLength =
FIND( ",",
Sheet3[Tags],
FIND(tag,Sheet3[Tags])+LEN(tag)+3)-(FIND(tag,Sheet3[Tags])+LEN(tag)+3)-1
RETURN
MID(
Sheet3[Tags],
FIND(tag,Sheet3[Tags])+LEN(tag)+3,
textLength)
I have also added the Variable tag. Now, you simply have to get whatever tag you're looking for and replace "application" with the tag.
This should solve your issue! Please mark this post as the solution to help others! 😁
Hello,
been reading the whole post and tried it out. I am not very familiar with powerbi code but as I changed it to suit my setup, it came back with an error that was not mentioned in this thread:
Code:
dept=
VAR tag = "dept"
VAR textLength =
FIND( ",",
usagedetails[Tags],
FIND(tag,usagedetails[Tags])+LEN(tag)+3)-(FIND(tag,usagedetails[Tags])+LEN(tag)+3)-1
RETURN
MID(
usagedetails[Tags],
FIND(tag,usagedetails[Tags])+LEN(tag)+3,
textLength)
Error:
A single value for column 'Tags' in table 'Usagedetails' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
It either does not seem to be performing the "find" in the column or it can't find the column name.
It does not look like anyone else has encountered this issue?