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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
erezbenmoshe
Advocate I
Advocate I

Count equal values across two rows

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I am trying to write a measure that counts the number of [Id] where [Total] is the same for the two [Datatype]s, method1 and method2. 

 

The count for the data above should be 5.

 

Thanks!

Erez 

1 ACCEPTED SOLUTION

@erezbenmoshe

 

Here is a MEASURE

 

Measure =
COUNTX (
    FILTER (
        VALUES ( Table1[ID] ),
        CALCULATE ( SUM ( Table1[Total] ), Table1[Data Type] = "Method1" )
            = CALCULATE ( SUM ( Table1[Total] ), Table1[Data Type] = "Method2" )
    ),
    1
)

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

 

Will there only be 2 data types or can there be more as well?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Only 2 data types

Greg_Deckler
Community Champion
Community Champion

Well, one way to do this would be to use a calculated column like this:

 

SameTotal = COUNTX(FILTER(Table,Table[Id]=EARLIER(Table[Id]) && Table[DataType]<>EARLIER(Table[DataType]) && Table[Total]=EARLIER(Table[Total])),[Total])

Then you could create a measure that just SUM'd SameTotal or did a COUNT of SameTotal and divided the result of that by the number of methods.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@erezbenmoshe

 

Here is a MEASURE

 

Measure =
COUNTX (
    FILTER (
        VALUES ( Table1[ID] ),
        CALCULATE ( SUM ( Table1[Total] ), Table1[Data Type] = "Method1" )
            = CALCULATE ( SUM ( Table1[Total] ), Table1[Data Type] = "Method2" )
    ),
    1
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.