Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi
I have a question with a litle challange
i have data like this..
Order Name Type ship From To Days
| 001 | ABC | cdc | bcb | 20/2/2022 | 25/2/2022 | 6 |
and would like to end up with something like this
Order Name Type ship Date
| 001 | ABC | cdc | bcb | 20/2/2022 |
| 001 | ABC | cdc | bcb | 21/2/2022 |
| 001 | ABC | cdc | bcb | 22/2/2022 |
| 001 | ABC | cdc | bcb | 23/2/2022 |
| 001 | ABC | cdc | bcb | 24/2/2022 |
| 001 | ABC | cdc | bcb | 25/2/2022 |
what is the best way to achieve this in power query where i am using Direc Query as the connection mode
the DQ is the challange as I would prefer the query not to break. 🙂
my thoughts so far went to create table with dates only and then add some dynamic logic that would add new column everytime there is new ship .. and then unpivot al this and remove records where there is 0 value .. but that doesnt sounds right. and was breaking
thank you for your help..
Solved! Go to Solution.
@buchta , I doubt that you can do this in Direct Query mode, we can generate a list and add that dates and expand. But I doubt that will work in Direct Query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJ0cgaSySnJQDIpOQlIGhnoG+kbGRgZgdimMHasTrQSSMTF1Q1IFhcXA8mc/ByQGiMk9RZw9bEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Order = _t, Name = _t, Type = _t, ship = _t, From = _t, To = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Order", Int64.Type}, {"Name", type text}, {"Type", type text}, {"ship", type text}, {"From", type date}, {"To", type date}}, "fr"),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Span", each List.Transform({Number.From([From])..Number.From([To])}, Date.From)),
#"Expanded Span" = Table.ExpandListColumn(#"Added Custom", "Span")
in
#"Expanded Span"
| 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("i45WMlTSUXJ0cgaSySnJQDIpOQlIGhnoG+kbGRgZgdimMHasTrQSSMTF1Q1IFhcXA8mc/ByQGiMk9RZw9bEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Order = _t, Name = _t, Type = _t, ship = _t, From = _t, To = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Order", Int64.Type}, {"Name", type text}, {"Type", type text}, {"ship", type text}, {"From", type date}, {"To", type date}}, "fr"),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Span", each List.Transform({Number.From([From])..Number.From([To])}, Date.From)),
#"Expanded Span" = Table.ExpandListColumn(#"Added Custom", "Span")
in
#"Expanded Span"
| 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! |
@buchta , I doubt that you can do this in Direct Query mode, we can generate a list and add that dates and expand. But I doubt that will work in Direct Query
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |