Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Visualization to show Country only

Hi Everyone, I have a data set currently that has columns of information containing city and country. For example:  When i create a visualization it will show as:   Is there anyway that i ...
  • v-xicai's avatar
    6 years ago

    Hi Anonymous ,

     

    You can create columns like DAX below.

     

    Country =
    var FirstComma = FIND(",",'Table1'[Location],1)
    var SecondComma = FIND(",",'Table1'[Location],FirstComma + 1)
    var LengthOfString = LEN('Table1'[Location])
    return
    MID('Table1'[Location],SecondComma + 1, LengthOfString - SecondComma + 1)
     
    City =
    var FirstComma = FIND(",",'Table1'[Location],1)
    var SecondComma = FIND(",",'Table1'[Location],FirstComma + 1)
    return
    LEFT(Table1[Location],SecondComma-1)
     

     

     

     

     

     

    Best Regards,

    Amy

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.