Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX help

Hi all,

I have metadatas_ column which is like in below format

{"v":[{"v":{"f":[{"v":"40187"},{"v":"life"},{"v":[{"v":{"f":[{"v":"en"},{"v":"Learn"}]}}]},{"v":[]}]}},{"v":{"f":[{"v":"57236"},{"v":"live"},{"v":[{"v":{"f":[{"v":"en"},{"v":"China"}]}},{"v":{"f":[{"v":"fr"},{"v":"Chine"}]}},{"v":{"f":[{"v":"it"},{"v":"Cina"}]}},{"v":{"f":[{"v":"pl"},{"v":"Chiny"}]}},{"v":{"f":[{"v":"sr"},{"v":"Kina"}]}}]},{"v":[]}]}},{"v":{"f":[{"v":"50267"},{"v":"live"},{"v":[{"v":{"f":[{"v":"en"},{"v":"India and Asia Pacific"}]}}]},{"v":[]}]}}]}

In this it contains both China, India and Asia Pacific

So like wise if metadata_ contains more than one of following values “China, Enlarged Europe, India and Asia Pacific, Middle East & Africa, North America, South America” it should give output as for those rows  as Locality
If metadata_ contains any one of following values “China, Enlarged Europe, India and Asia Pacific, Middle East & Africa, North America, South America” it should give output for those rows  as Region

also if metadatas_ contains text like "Globe" it should give output for those rows as Globe

all this condition need to created in a single column

Please Help to achieve this!!!!

Thanks in advance

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

maybe you can try this

Column = 
VAR _c=if(SEARCH("China",'Table'[metadatas],1,0)>0,1,0)
VAR _ee=if(SEARCH("Enlarged Europe",'Table'[metadatas],1,0)>0,1,0)
VAR iap=if(SEARCH("India and Asia Pacific",'Table'[metadatas],1,0)>0,1,0)
VAR mea=if(SEARCH("Middle East & Africa",'Table'[metadatas],1,0)>0,1,0)
VAR na=if(SEARCH("North America",'Table'[metadatas],1,0)>0,1,0)
VAR sa=if(SEARCH("South America",'Table'[metadatas],1,0)>0,1,0)
var g=if(SEARCH("Globe",'Table'[metadatas],1,0)>0,1,0)
return if(g=1,"Globe",if(_c+_ee+iap+mea+na+sa>1,"Locality",if(_c+_ee+iap+mea+na+sa=1,"Region")))

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

@Anonymous 

maybe you can try this

Column = 
VAR _c=if(SEARCH("China",'Table'[metadatas],1,0)>0,1,0)
VAR _ee=if(SEARCH("Enlarged Europe",'Table'[metadatas],1,0)>0,1,0)
VAR iap=if(SEARCH("India and Asia Pacific",'Table'[metadatas],1,0)>0,1,0)
VAR mea=if(SEARCH("Middle East & Africa",'Table'[metadatas],1,0)>0,1,0)
VAR na=if(SEARCH("North America",'Table'[metadatas],1,0)>0,1,0)
VAR sa=if(SEARCH("South America",'Table'[metadatas],1,0)>0,1,0)
var g=if(SEARCH("Globe",'Table'[metadatas],1,0)>0,1,0)
return if(g=1,"Globe",if(_c+_ee+iap+mea+na+sa>1,"Locality",if(_c+_ee+iap+mea+na+sa=1,"Region")))

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi Ryan,

Thanks a lot
It helped...

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi,

one more help....can you please help me to get it in power query as a custom column....it will be helpful

Thanks
sai

@Anonymous 

I have provided a solutin in PQ, pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.