Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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.
Setor | ParteCorpo | direita/Esquerda | data inicial | data final |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 01/10/2022 | 10/10/2022 |
PRODUÇÃO | PULSO | ESQUERDA | 02/10/2022 | 05/10/2022 |
PRODUÇÃO | LOMBAR INFERIOR | 10/10/2022 | 21/10/2022 |
Setor | ParteCorpo | direita/Esquerda | data inicial |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 01/10/2022 |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 02/10/2022 |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 03/10/2022 |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 04/10/2022 |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 05/10/2022 |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 06/10/2022 |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 07/10/2022 |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 08/10/2022 |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 09/10/2022 |
PRODUÇÃO | BRAÇO INFERIOR | DIREITA | 10/10/2022 |
PRODUÇÃO | PULSO | ESQUERDA | 02/10/2022 |
PRODUÇÃO | PULSO | ESQUERDA | 03/10/2022 |
PRODUÇÃO | PULSO | ESQUERDA | 04/10/2022 |
PRODUÇÃO | PULSO | ESQUERDA | 05/10/2022 |
PRODUÇÃO | LOMBAR INFERIOR | 10/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 11/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 12/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 13/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 14/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 15/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 16/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 17/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 18/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 19/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 20/10/2022 | |
PRODUÇÃO | LOMBAR INFERIOR | 21/10/2022 |
Solved! Go to Solution.
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
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! |
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
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! |
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}))
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
6 | |
6 | |
6 | |
5 |