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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
JonKho
Frequent Visitor

Convert Calculated Column to DAX Measure to detect one of two values

Hi all

 

Previously from this thread, https://community.fabric.microsoft.com/t5/Desktop/How-to-find-duplicate-values-in-one-column-while-a...

 

Thanks to one for the members, Ashish_Mathur to create a way to find the duplicate values through the formula shown below.

 

 

 

Column = if(CALCULATE(DISTINCTCOUNT(Scanned_Item_Two_Controllers[Scan_Controller_Node_Id]),FILTER(Scanned_Item_Two_Controllers,Scanned_Item_Two_Controllers[Page_Barcode]=EARLIER(Scanned_Item_Two_Controllers[Page_Barcode])))>1,"Duplicate Found!","Unique")

 

I have created another new measure that represent what I want to do where I can detect, 'Duplicate Found!'

 

Filter Value =
CALCULATE(
COUNTA('Scanned_Item_Two_Controllers'[Column]),
'Scanned_Item_Two_Controllers'[Column] IN { "Duplicate Found!" }
)

 

 

 

I hope to get more insights on this matter.
 
Thank you for reading this thread.
1 ACCEPTED SOLUTION
xifeng_L
Super User
Super User

Hi @JonKho ,

 

You can try below measure.

 

xifeng_L_0-1716193872524.png

 

Measure = 
CALCULATE(
    COUNTROWS('Table'),
    FILTER(
        'Table',
        CALCULATE(
            DISTINCTCOUNT('Table'[Controller_Node_Id]),
            ALLEXCEPT('Table','Table'[BarCode])
        )>1
    )
)

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

 

View solution in original post

3 REPLIES 3
mark_endicott
Super User
Super User

@JonKho - If you are trying to count the number of Duplicate Values I would use:

 

 

CALCULATE ( COUNTROWS ( Table ), KEEPFILTERS ( Table[Column] = "Duplicate Value" ) )

 

 

If you would like the number of ID's with duplicates you can use:

 

 

CALCULATE ( DISTINCTCOUNT ( Table[Column] ), KEEPFILTERS ( Table[Column] = "Duplicate Value" ) )

 

xifeng_L
Super User
Super User

Hi @JonKho ,

 

You can try below measure.

 

xifeng_L_0-1716193872524.png

 

Measure = 
CALCULATE(
    COUNTROWS('Table'),
    FILTER(
        'Table',
        CALCULATE(
            DISTINCTCOUNT('Table'[Controller_Node_Id]),
            ALLEXCEPT('Table','Table'[BarCode])
        )>1
    )
)

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

 

Thank you @xifeng_L 

 

Your solution works.

 

If you are available, I appreciate that you can help me to provide your insight on this topic, https://community.fabric.microsoft.com/t5/Desktop/Unable-to-perform-COUNT-for-flag-value/m-p/3934860...

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors