Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Automatic dax for duplicates certain value to new table

Delion_0-1653976755353.png

 

Hi 

I have table A and I want to create table B , which is only keeping latest value from max=index using dax

 

Is it possible ?

 

many thanks

 

6 REPLIES 6
Anonymous
Not applicable

Hi  @Anonymous ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can achieve it in Power Query Editior by the following codes:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pcmxDQAgCATAXagt4BFlF+L+a6iN9NhdchGkLNQIDLCJHaoarVaLnjE/Y2b4ZyBjXCqXw19A6rE2", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Index = _t, DATE = _t, VALUE = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}, {"DATE", Int64.Type}, {"VALUE", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"VALUE"}, {{"MaxIndex", each List.Max([Index]), type nullable number}, {"Details", each _, type table [Index=nullable number, DATE=nullable number, VALUE=nullable number]}}),
    #"Expanded Details" = Table.ExpandTableColumn(#"Grouped Rows", "Details", {"Index", "DATE"}, {"Index", "DATE"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Details", "Display", each if [MaxIndex]=[Index] then 1 else 0),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Display] = 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"MaxIndex", "Display"})
in
    #"Removed Columns"

yingyinr_0-1655282087431.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

You could create a measure as below and use it as visual level filter:-

Measure = 
if(MAX('Table'[Index]) = CALCULATE(MAX('Table'[Index]),ALL('Table')),1,0)

Samarth_18_0-1653977470161.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Thank @Samarth_18 for replied 

 

I tried your measure, but new column showing as 1 for all rows 

 

Delion_0-1653978422618.png

 

@Anonymous , Please create it as measure instead of column.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Still same, it's only have one value  = 1, no 0 in measure

@Anonymous ,Since all the details of three records are same thats why it will display only 1 record on visual. If you have any other column which can act as distinct then you have to add that column as well on visual.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.