cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Oscar_Mtz_V
Kudo Commander
Kudo Commander

DAX to summarize a table bringing only the last date of duplicate records.

Hi, I have "TABLE 1" where I have duplicate records, the issue is that while summarizing for getting unique records, as someone missepelled the name, I am getting two records for a single ID, as in case of ID 8 on my "Current Result" Table, this is incorrect.

 

The ideal would be to have something like the "DESIRED RESULT" table.

 

I need to used DAX as I do not have access to the data source for doing this from the Query.

 

Annotation 2019-10-27 095537.png

 

DAX I am currently using, which is not working is:

 

RESULT = 
SUMMARIZE(
    'TABLE1',
    'TABLE1'[ID],
    'TABLE1'[NAME]
)
1 ACCEPTED SOLUTION

Thanks @Zubair_Muhammad , although your DAX proposal was not 100% of what I needed it guide me through to get the right result, DAX can be found below.

 

RESULT =
FILTER (
    'TABLE1',
    'TABLE1'[DATE]
        = CALCULATE (
            MAX ( 'TABLE1'[DATE] ),
            ALLEXCEPT ( TABLE1, 'TABLE1'[ID] )
        )
)

This was because the "ID" is the column that contained all the right ID's, no typos.

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

Hi @Oscar_Mtz_V 

 

Try following

 

RESULT =
FILTER (
    'TABLE1',
    'TABLE1'[DATE]
        = CALCULATE (
            MAX ( 'TABLE1'[DATE] ),
            ALLEXCEPT ( TABLE1, 'TABLE1'[NAME], 'TABLE1'[ID] )
        )
)

Regards
Zubair

Please try my custom visuals

Thanks @Zubair_Muhammad , although your DAX proposal was not 100% of what I needed it guide me through to get the right result, DAX can be found below.

 

RESULT =
FILTER (
    'TABLE1',
    'TABLE1'[DATE]
        = CALCULATE (
            MAX ( 'TABLE1'[DATE] ),
            ALLEXCEPT ( TABLE1, 'TABLE1'[ID] )
        )
)

This was because the "ID" is the column that contained all the right ID's, no typos.

This is just I need, thanks.

Anonymous
Not applicable

Hey guys,

I believe i have the same issue, but i got this message...Capture.JPG

 

My measure is:

Result =
FILTER (
'Main Calendar',
'Main Calendar'[Date]
= CALCULATE (
MAX ('Main Calendar'[Date]),
ALLEXCEPT ( 'Main Costs', 'Main Costs'[Department], 'Main Costs'[Item], 'Main Costs'[Item Name], 'Main Costs'[Family], 'Main Costs'[Sub-Family], 'Main Costs'[Qty], 'Main Costs'[Un Price],'Main Costs'[NetValue],'Main Costs'[VatRt], 'Main Costs'[GrossTotal] )
)
)

Any ideas?

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors