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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
viralpatel21
Helper II
Helper II

Find Unique and Duplicate Values Count in Power BI Based on Multiple Conditions

Hello

 

I am trying to create the  column  "dentifying" to calculate duplicates based on Multiple conditions.. i.e. 

 

e.g. if the name has a duplicate but the match status has has "monitored" and " unmonitortesd" then the identifying column should say "yes".

 

NameMatch statusIdentifying
aMonitoredno
aMonitoredno
aMonitoredno
aMonitoredno
bMonitoredno
cUnmonitoredno
dUnmonitoredno
eMonitoredyes
eMonitoredyes
eUnmonitoredyes
dMonitoredyes
dUnmonitoredyes
fMonitoredno
hMonitoredyes
hUnmonitoredyes
hMonitoredyes
1 ACCEPTED SOLUTION

Hi @Raghu26 ,

You can create a calculated column as below to get it, please find the details in the attachment.

Identifying = 
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Match status] ),
        FILTER (
            'Table',
            'Table'[Name] = EARLIER ( 'Table'[Name] )
                && 'Table'[Match status] IN { "Monitored", "Unmonitored" }
        )
    )
RETURN
    IF ( _count > 1, "yes", "no" )

yingyinr_0-1676625820400.pngBest Regards 

Community Support Team _ Rena
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

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @viralpatel21 ,

I created a sample pbix file(see the attachment), please check if that is waht you want.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUfLNz8ssyS9KTQGy8/KVYnWoJJyEXTgZyAzNy8WUSMElkYpmUGVqMUFxVINgMik4dGBaDZNJw+6JDBwGZeA0CKuOWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, #"Match status" = _t, Identifying = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Match status", type text}, {"Identifying", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Name", "Match status", "Identifying"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"

yingyinr_0-1676617230568.png

If the above ones can't help you, could you please provide your expected result base on your shared sample data? And which conditions it need to satisfy? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

Thank you for the solution. But i dont think i have correctly explained myself.

 

The identifying column is the column which i want to achieve.  

ie.e if the name has a duplicate but the match status has has "monitored" and " unmonitorted" then the identifying column should say "yes".

Hi @Raghu26 ,

You can create a calculated column as below to get it, please find the details in the attachment.

Identifying = 
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Match status] ),
        FILTER (
            'Table',
            'Table'[Name] = EARLIER ( 'Table'[Name] )
                && 'Table'[Match status] IN { "Monitored", "Unmonitored" }
        )
    )
RETURN
    IF ( _count > 1, "yes", "no" )

yingyinr_0-1676625820400.pngBest Regards 

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

Thank you so much!!! it worked brilliantly!!

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.