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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
madhav2020
Frequent Visitor

Dax query to count unique values in a column by comparing it with other column

Hey folks,

 

Need your help with a query.

 

Here goes the problem definition,

 

Below table has ID column with unquie values and the corresponding Risk factor column which has same/different values.

 

Now expected output will be to check if values in Risk Factor column is changing wrt ID and if does then expected ouput will be 1 and if not then 0 as shown below.

Risk                   OIDExpected output
11.021445.34552.17462.60490        1
75.321445.34552.17462.60490 
73.621445.34552.17462.60490 
72.521445.34552.17486.61667         0
11.021445.34552.17510.33157         0
11.021445.34552.17510.33157 
0.021445.34552.17511.36651         0
0.021445.34552.17511.36651 
0.021445.34552.17511.36651 
0.021445.34552.17511.36651 
0.021445.34552.17511.36651 
0.021445.34552.17511.36651 
0.021445.34552.17511.36651 
0.021445.34552.17511.36651 
81.121445.34552.17558.59465            1 
76.421445.34552.17558.59465 
0.021445.34552.17608.42491            0
0.021445.34552.17608.42491 
0.021445.34552.17608.42491 
100.021445.34552.17637.32864             0
100.021445.34552.17637.32864 
42.321445.34552.17689.35090              0
1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @madhav2020 

New column =
IF (
    CALCULATE ( DISTINCTCOUNT ( Table1[Risk] ), ALLEXCEPT ( Table1, Table1[OID] ) ) > 1,
    1,
    0
)

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

View solution in original post

1 REPLY 1
AlB
Community Champion
Community Champion

Hi @madhav2020 

New column =
IF (
    CALCULATE ( DISTINCTCOUNT ( Table1[Risk] ), ALLEXCEPT ( Table1, Table1[OID] ) ) > 1,
    1,
    0
)

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

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.