Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello,
I am attempting group my table of IncomingWork items by CustomerID as well as if they have been created within 72hours from the earliest entry. I have created the sample table with data below and how the items should be counted.
The end result should have CustomerID 1001 have a total of 2 items, and 2001 a total of 1 item.
I am not familiar enough with DAX functions to complete this, is anyone able to assist me?
Thank you in advance.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ndAxDsAgCEDRuzBrghhsO7bXMN7/Gg52qd/BdH0DfKhVbgliaimqx5SlhYlOkCnJt6iQOD5z/IrSRCXqoIcH/SAnlS06SBfofeGHWG/sWhFTjV2ZG1c0R4yvtg4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [CustomerID = _t, Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"CustomerID", type text}, {"Date", type date}}),
#"Grouped Rows" = Table.RemoveColumns(Table.Group(#"Changed Type", {"CustomerID"}, {{"ar", each Table.AddIndexColumn(Table.Group(_, "Date", {"All", each _}, 0, (x,y) => Number.From(Duration.Days(y-x)>=3)),"Index",1)}}), "CustomerID"),
#"Expanded ar" = Table.RemoveColumns(Table.ExpandTableColumn(#"Grouped Rows", "ar", {"Date", "All", "Index"}, {"Date", "All", "Index"}), "Date"),
#"Expanded All" = Table.ExpandTableColumn(#"Expanded ar", "All", {"CustomerID", "Date"}, {"CustomerID", "Date"})
in
#"Expanded All"
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! |
Thank you for the quick reply. I apologize though, I meant to ask this for in a Measure format.
User | Count |
---|---|
57 | |
22 | |
21 | |
19 | |
16 |
User | Count |
---|---|
86 | |
84 | |
52 | |
37 | |
23 |