Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

DAX Code that pulls out values when they differentiate between columns

Is there a way to to pull out rows that have a duplicate value in one column but different value in another column

 

 

So when I load this dataset into PowerBI, I want to to pull out IDs 1 and 3, and pull out the two programs that their two programs (1:Grocery/Supermarket, 3:Retail/Supermarket).

Currently my DAX code looks like

 

 

 

dupecounter = CALCULATE(
             COUNTA('Data'[ID]),
             FILTER('Data', 'Data'[Program] <> EARLIER('Data'[Program])
       ))

 

 

But its not quite doing what I need it to do

2 Replies

  • Anonymous , Output you want is not clear. This measure with id column should give you 1,3

    countx(filter(summarize('Data', 'Data'[ID] , "_1",COUNTA('Data'[ID])) ,[_1]>1),[ID])

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi Anonymous ,

     

    Create a measure like this and apply it to visual level filter.

    Measure 4 = CALCULATE(DISTINCTCOUNT('Table (2)'[Program]),ALLEXCEPT('Table (2)','Table (2)'[ID]))

     

     

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