Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, people!
I need to create a list with cicle and year.
1-2010
2-2015
3-2020
I am using
let
ano05 = 2010,
AnoAtual = 2021,
troca04_ciclo = 60,
Fonte = List.Generate(()=>ano05, each _ <= AnoAtual, each _ + Number.RoundUp(troca04_ciclo/12))
in
Fonte
But I don´t know how to do it.
Any ideias?
Solved! Go to Solution.
If you want a list {"1-2010", "2-2015", "3-2020"}, then you could try this:
let
ano05 = 2010,
AnoAtual = 2021,
troca04_ciclo = 60,
step = Number.RoundUp(troca04_ciclo / 12),
N = Number.RoundUp((AnoAtual - ano05) / step),
Fonte = List.Transform({1..N}, each {_, ano05 + step * (_ - 1)}),
ToText = List.Transform(Fonte, each Number.ToText(_{0}) & "-" & Number.ToText(_{1}))
in
ToText
If you want a list {"1-2010", "2-2015", "3-2020"}, then you could try this:
let
ano05 = 2010,
AnoAtual = 2021,
troca04_ciclo = 60,
step = Number.RoundUp(troca04_ciclo / 12),
N = Number.RoundUp((AnoAtual - ano05) / step),
Fonte = List.Transform({1..N}, each {_, ano05 + step * (_ - 1)}),
ToText = List.Transform(Fonte, each Number.ToText(_{0}) & "-" & Number.ToText(_{1}))
in
ToText
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.