Forum Discussion
Summarize with distinct values
Hello everyone!
I have a table that i created using summarize:
| ID | Age | Description |
1 | 10 | aaa |
| 1 | 11 | aaa |
| 3 | 12 | bbb |
| 3 | 12 | bbb |
I need create a summarize with disticnt values, if its possible, but i dont know to do it.
Exemple of output:
| ID | Age | Description1 |
| 1 | 11 | aaa |
| 3 | 12 | bbb |
Doesnt matter wich age wil be print (10 or 11), i just need one ID on my table.
Hello @henriquemalone ,
Create a column as shown below:
Column = var _previousid=CALCULATE(MAX('Table'[ID]),FILTER('Table','Table'[ID]=EARLIER('Table'[ID])&&'Table'[Age]<EARLIER('Table'[Age]))) Return IF(_previousid=BLANK(),'Table'[Description],BLANK())Next, you'll see:
For the related .pbix file, see attachment pls.
Saludos
KellyHave I answered your question? Mark my position as a solution!
3 Replies
- v-kelly-msftCommunity Support
Hello @henriquemalone ,
Create a column as shown below:
Column = var _previousid=CALCULATE(MAX('Table'[ID]),FILTER('Table','Table'[ID]=EARLIER('Table'[ID])&&'Table'[Age]<EARLIER('Table'[Age]))) Return IF(_previousid=BLANK(),'Table'[Description],BLANK())Next, you'll see:
For the related .pbix file, see attachment pls.
Saludos
KellyHave I answered your question? Mark my position as a solution!
- PaulDBrownCommunity Champion
Anonymous
Are you creating a dimension table for IDs?
If so, create a new table using VALUES(table[id])
then create a relationship between this dimension table and your fact table by linking the id fields. Use the dimension Id in your visuals.
However, beware that if you include the age column the id = 1 will be repeated since there are 2 age values for this id. If you want to avoid this, create a measure to find the MAX value for age and use that measure instead of the column in the visual - negi007Community Champion
Anonymous Open your data in power query window and there you can remove duplicate values like below. right click on the ID column and select remove duplicates
or directly use below code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI0ABKJiYlKsTpQAUMkAWOQgBGQSEpKwiIQCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Age = _t, Description = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Age", Int64.Type}, {"Description", type text}}),
#"Removed Duplicates1" = Table.Distinct(#"Changed Type", {"ID"})
in
#"Removed Duplicates1"