Give this a go, just paste the code into a new blank query.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtA1VdJRMlSK1YlWMtM1NAByjMAcQ0NtINtYKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Canine lifespan" = _t, #"Sort Order" = _t]),
AddLists = Table.AddColumn(Source, "Years", each if [Sort Order] ="1" then {0..5} else if [Sort Order] ="2" then {6..10} else {11..30})[[Canine lifespan], [Years]],
ExpandYears = Table.ExpandListColumn(AddLists, "Years")
in
ExpandYears
.
Adjust according to your own needs.
I hope this is helpful
It will be hard to provide assistance without a file and more detailsā¦
Please create a new topic and supply a sample PBIX (with mockup data file XLSX)