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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.