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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

I would like the dates to be only in a column repeating the information "Part of the Body" but the dates to be filled from the start date to the end date.

Hello I'm from Brazil, I have a table in the medical certificate power query, I have the following columns: "Part of the Body"; "Initial date"; " "End Date" on the same line, I would like the dates to be only in a column repeating the information "Part of the Body" but the dates to be filled from the start date to the end date.

 

SetorParteCorpodireita/Esquerdadata inicialdata final
PRODUÇÃOBRAÇO INFERIORDIREITA01/10/202210/10/2022
PRODUÇÃOPULSOESQUERDA02/10/202205/10/2022
PRODUÇÃOLOMBAR INFERIOR 10/10/202221/10/2022
 
below, how the table should look. Filling the date ranges in each row 😀
 
SetorParteCorpodireita/Esquerdadata inicial
PRODUÇÃOBRAÇO INFERIORDIREITA01/10/2022
PRODUÇÃOBRAÇO INFERIORDIREITA02/10/2022
PRODUÇÃOBRAÇO INFERIORDIREITA03/10/2022
PRODUÇÃOBRAÇO INFERIORDIREITA04/10/2022
PRODUÇÃOBRAÇO INFERIORDIREITA05/10/2022
PRODUÇÃOBRAÇO INFERIORDIREITA06/10/2022
PRODUÇÃOBRAÇO INFERIORDIREITA07/10/2022
PRODUÇÃOBRAÇO INFERIORDIREITA08/10/2022
PRODUÇÃOBRAÇO INFERIORDIREITA09/10/2022
PRODUÇÃOBRAÇO INFERIORDIREITA10/10/2022
PRODUÇÃOPULSOESQUERDA02/10/2022
PRODUÇÃOPULSOESQUERDA03/10/2022
PRODUÇÃOPULSOESQUERDA04/10/2022
PRODUÇÃOPULSOESQUERDA05/10/2022
PRODUÇÃOLOMBAR INFERIOR 10/10/2022
PRODUÇÃOLOMBAR INFERIOR 11/10/2022
PRODUÇÃOLOMBAR INFERIOR 12/10/2022
PRODUÇÃOLOMBAR INFERIOR 13/10/2022
PRODUÇÃOLOMBAR INFERIOR 14/10/2022
PRODUÇÃOLOMBAR INFERIOR 15/10/2022
PRODUÇÃOLOMBAR INFERIOR 16/10/2022
PRODUÇÃOLOMBAR INFERIOR 17/10/2022
PRODUÇÃOLOMBAR INFERIOR 18/10/2022
PRODUÇÃOLOMBAR INFERIOR 19/10/2022
PRODUÇÃOLOMBAR INFERIOR 20/10/2022
PRODUÇÃOLOMBAR INFERIOR 21/10/2022
 
Thanks!!
 
 
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCgjydwk93H642V9JR8kpyPFwu7+Cp5+ba5CnfxBQxMUzyNUzxBHIMtQ3NNA3MjAyArEN4JxYHTQzAkJ9gkG0a3BgqGuQC0irEZJWU9w6ffx9nRyDkG1HtQpoEMIRsbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Setor = _t, ParteCorpo = _t, #"direita/Esquerda" = _t, #"data inicial" = _t, #"data final" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Setor", type text}, {"ParteCorpo", type text}, {"direita/Esquerda", type text}, {"data inicial", type date}, {"data final", type date}}, "pt-BR"),
    Expanded = Table.ExpandListColumn(Table.CombineColumns(#"Changed Type", {"data inicial", "data final"}, each List.Dates(_{0}, Duration.TotalDays(_{1}-_{0})+1, #duration(1,0,0,0)), "Date"), "Date")
in
    Expanded

 

CNENFRNL_0-1665133173227.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCgjydwk93H642V9JR8kpyPFwu7+Cp5+ba5CnfxBQxMUzyNUzxBHIMtQ3NNA3MjAyArEN4JxYHTQzAkJ9gkG0a3BgqGuQC0irEZJWU9w6ffx9nRyDkG1HtQpoEMIRsbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Setor = _t, ParteCorpo = _t, #"direita/Esquerda" = _t, #"data inicial" = _t, #"data final" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Setor", type text}, {"ParteCorpo", type text}, {"direita/Esquerda", type text}, {"data inicial", type date}, {"data final", type date}}, "pt-BR"),
    Expanded = Table.ExpandListColumn(Table.CombineColumns(#"Changed Type", {"data inicial", "data final"}, each List.Dates(_{0}, Duration.TotalDays(_{1}-_{0})+1, #duration(1,0,0,0)), "Date"), "Date")
in
    Expanded

 

CNENFRNL_0-1665133173227.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

wdx223_Daniel
Super User
Super User

NewStep=#table(List.RemoveLastN(Table.ColumnNames(PreviousStepName)),List.TransformMany(Table.ToRows(PreviousStepName),each List.Dates(_{3},Duration.Days(_{4}-_{3}),Duration.From(1)),(x,y)=>List.RemoveLastN(x)&{y}))

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.