Forum Discussion
victorbetancurt
7 years agoRegular Visitor
Distinct Count with value in same table
Hi everyone. Beforehand, sorry for my bad english. I have a table like this ('Table1'): CODE STATE 1015 A 1016 A 1017 B 1015 B 1016 B 1017 B 1015 C 1015 A 10...
- 7 years ago
Another thing you may want to try then is instead of appending the two data tables, merge them side by side.
So intead of your original table, you end up with something like this:
CODE PREV_STATE CUR_STATE CHANGED 1015 A A TRUE 1016 A B FALSE 1017 B B TRUE If whatever index you're using for each row stays the same between days, this may be a better way to store your data. Be sure to check my previous reply for DAX code to solve your original problem
Mariusz
7 years agoCommunity Champion
Please see the below M code for Custom Column
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwNFXSUXJUitUBc8yQOeZAjhOMY4rMMUPmYChzRuagmxYLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Code = _t, State = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Code", Int64.Type}, {"State", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each let c = [Code], s = [State] in
Table.RowCount(
Table.SelectRows(
#"Changed Type",
each [Code] = c and [State] = s
)
), Int64.Type)
in
#"Added Custom"Regards,
Mariusz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
victorbetancurt
7 years agoRegular Visitor
It's not working. The query generates (loading here) a data processing of more than 3 gb.