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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
CSpina
Helper III
Helper III

Creating a list with cicle and years

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?

 

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

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

View solution in original post

1 REPLY 1
AlexisOlson
Super User
Super User

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Kudoed Authors