Forum Discussion

Cocrodile's avatar
Cocrodile
Icon for Helper I rankHelper I
2 years ago
Solved

Double row one result

DTA ID VALUE 2024-07-01  12345  8 2024-07-01 12345  8 2024-07-01 12347 8 I need to create a measurement that makes me output Value= 8 for ID=12345 when the DTA is the same. I...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Cocrodile ,

    I create a table as you mentioned.

    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
        )

     

     

     

    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.