Forum Discussion
Distinct Count with value in same table
- 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
Cmcmahan, I did it, but I lost the another columns, I want to keep them (in the example bottom I didn´t show them).
PD: I suggested Power Query for better performance, (I think). If there is another way to achieve this without impacting performance, feel free to help me.
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.
- victorbetancurt7 years agoRegular Visitor
It's not working. The query generates (loading here) a data processing of more than 3 gb.