Forum Discussion

925stuart's avatar
925stuart
Helper I
2 years ago
Solved

How do I convert number ranges into a text?

Hi, 

 

How do I convert number ranges into a text?  E.g. 

 

  • <1 = "Text1"
  • > 0 but <11 = "Text2"
  • > 10 but <21 = "Text3"
  • >20 = "Text 4"

 

Thanks!

  • Thanks for all your suggestions!  I finally used (a Youtube solution) Switch to compare the number against a range to yield a True/False, and then assigning a Text value depending on the Binary test.   

3 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion
    let
        Source = #table(1,List.Zip({{0..25}})),
        Custom1 = Table.AddColumn(Source,"Custom",each {"Text1","Text2","Text3","Text4"}{List.PositionOf({1,11,21},[Column1],1,(x,y)=>y>=x)+1})
    in
        Custom1
  • Thanks for all your suggestions!  I finally used (a Youtube solution) Switch to compare the number against a range to yield a True/False, and then assigning a Text value depending on the Binary test.