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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Cocrodile
Helper I
Helper I

Double row one result

DTAIDVALUE
2024-07-01 12345 8
2024-07-0112345 8
2024-07-01123478

I need to create a measurement that makes me output Value= 8 for ID=12345 when the DTA is the same.

I Don't want sum but distinct 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Cocrodile ,

I create a table as you mentioned.

vyilongmsft_0-1720581850384.png

Then I create a calculated column and here is the DAX code.

Column = 
VAR CurrentRowDTA = 'Table'[DTA]
VAR CurrentRowID = 'Table'[ID]
VAR CurrentRowVALUE = 'Table'[VALUE]
RETURN
    IF (
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[DTA] = CurrentRowDTA
                    && 'Table'[ID] = CurrentRowID
                    && 'Table'[VALUE] = CurrentRowVALUE
            )
        ) > 1,
        1,
        0
    )

vyilongmsft_1-1720582029304.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Cocrodile ,

I create a table as you mentioned.

vyilongmsft_0-1720581850384.png

Then I create a calculated column and here is the DAX code.

Column = 
VAR CurrentRowDTA = 'Table'[DTA]
VAR CurrentRowID = 'Table'[ID]
VAR CurrentRowVALUE = 'Table'[VALUE]
RETURN
    IF (
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[DTA] = CurrentRowDTA
                    && 'Table'[ID] = CurrentRowID
                    && 'Table'[VALUE] = CurrentRowVALUE
            )
        ) > 1,
        1,
        0
    )

vyilongmsft_1-1720582029304.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

DataNinja777
Super User
Super User

Hi @Cocrodile ,

There are many ways to achive your required outputs and one of them is to use the dax formula like below to create a calculated table which doesn't contain duplicate rows:

Table 2 = calculatetable(distinct('Table'))

 

DataNinja777_0-1720242078835.png

I attach a pbix file as an example.

Best regards,

must return all the results with the max value, by necessity I need all the rows because I have other information

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.