User Profile
ZhangKun
Super User
Joined 3 years ago
User Widgets
Contributions
Re: Add duplicate row based on column
if you want to add duplicate rows, you can add a list. let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtDAwMDcyUtJRMgZiRydnIGlgrOubWKRrZAZku6SWZSanGirF6oBVm5hamJoYAsVB2BGrWiOYWgsDQyNjA6haJ6xqjcFqDQ0NjIwMLI0sgOIgl+BwhIlSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [fid = _t, phaseCount = _t, phase = _t, extractDate = _t, deviceName = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"fid", Int64.Type}, {"phaseCount", Int64.Type}, {"phase", type text}, {"extractDate", type date}, {"deviceName", type text}}), #"Replaced Value" = Table.ReplaceValue(#"Changed Type",null,null,(old,new,z)=>List.Repeat({old}, Text.Length(old)),{"phase"}), #"Expanded {0}" = Table.ExpandListColumn(#"Replaced Value", "phase") in #"Expanded {0}"970Views2likes0CommentsRe: Dynamic Headers in DAX
DAX queries cannot generate dynamic column headers. You can use alternative solutions: 1. Filter rows for the last five days in Power Query. See the attached example for a simple example. (For testing, you'll need to manually set your computer's time, but remember to turn "Set Automatic Time" back on.) 2. Use headers like "1 Day Ago" and "2 Days Ago."1.1KViews1like0CommentsRe: PQ Column change to Date and filter previous week and current Week
let 源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content], 更改的类型 = Table.TransformColumnTypes(源,{{"dt", type text}}), 已添加自定义 = Table.AddColumn(更改的类型, "自定义", each Date.FromText([dt], [Format="dd'th' MMMM yyyy", Culture=""])), 筛选的行 = Table.SelectRows(已添加自定义, each Date.IsInPreviousWeek([自定义]) or Date.IsInCurrentWeek([自定义])) in 筛选的行794Views3likes1CommentRe: Column Dependencies/Usage Within Applied Steps
Congratulations on solving the problem. Reading column dependencies through DAX and M formulas are two different difficulty problems. Regardless of the scheme, you can only read the result table and the M formula, and even if you use the M engine to execute the query, you will not be able to find the column dependencies correctly. There are many operations that affect the result, such as adding columns, renaming, and converting tables to records.1.1KViews0likes0CommentsRe: IF Test Starts With in Power Query
The third parameter of the Text.StartsWith function can specify the comparison method. You can specify it as "Comparer.OrdinalIgnoreCase" to ignore case. Table.AddColumn(Table.FromValue({"London A", "lonDON"}), "NEW", each Text.StartsWith([Value], "london", Comparer.OrdinalIgnoreCase))5.8KViews1like0CommentsRe: DecimalNumber with 15 max limit not working while aggregation
The calculation order of double-precision floating-point numbers may lead to different results because the last digit is rounded differently in the calculation. For example, the following example: List.Transform({{-0.4, 0.1, 0.2, 0.3, -0.31, 0.1, 0.01}, {-0.4, 0.1, -0.31, 0.1, 0.01, 0.2, 0.3}}, List.Sum) Numbers in Power Query are all treated as double-precision floating point numbers, but some functions can specify the calculation precision (double-precision floating point or fixed-digit decimals), such as the following example: List.Transform({{-0.4, 0.1, 0.2, 0.3, -0.31, 0.1, 0.01}, {-0.4, 0.1, -0.31, 0.1, 0.01, 0.2, 0.3}}, each List.Sum(_, Precision.Decimal)) This is difficult to guarantee in DAX because the only currency types that guarantee precision are only accurate to 4 decimal places.999Views1like0CommentsRe: Change Column type based on cell content
You can remove the conversion step of column X (the column you expect) or replace the type with type any. Note that if you expect the results of column X to be exported to the model, this is invalid because all values of a single column in the model (or Power Pivot) will be converted to the same type. You can only output different types of values in the same column when using Power Query in Excel and exporting directly to a worksheet.792Views0likes0Comments
Data Privacy
Microsoft Fabric Community and Privacy
To learn more about how we manage your data, please review the Microsoft Fabric Community Data Privacy guide.