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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dw700d
Post Patron
Post Patron

distinct count aggregate

Good day all,

 

I am trying to create a measure that calculates the distinct count of Circuits with a profit greater than 0.   I am using the measure below. The measure appears to be evaluating on a row by row basis. as a result it is telling me that there are 2 Circuits with a profit greater than 0.  but I want the measure to evaluate the total profit for the circuit . Based on my data below the measure should return "1" because Circuit A has a -1,115 profit and Circuit C has a 1,789

 

Count of Profit Circuit =

CALCULATE(DISTINCTCOUNT('job'[Circuit #]),FILTER('job','job'[ Profit]>0))

 

 

Circuit #Date.Revenue Expense Profit  
A5/1/2022 0:00          108299-191
A6/1/2022 0:00108299-191
A10/1/2022 0:00115299-184
A11/1/2022 0:00115299-184
A12/1/2022 0:00115299-184
A7/1/2022 0:00116299-183
A8/1/2022 0:00116299-183
A9/1/2022 0:00119299-180
A2/1/2022 0:00109249-140
A3/1/2022 0:00109249-140
A1/1/2022 0:00437249188
A4/1/2022 0:00756299457
C4/1/2022 0:0080075842
C5/1/2022 0:0082075862
C6/1/2022 0:0083075872
C7/1/2022 0:00900758142
C8/1/2022 0:0080075842
C9/1/2022 0:0080075842
C2/1/2022 0:00830632198
C3/1/2022 0:00800632168
C10/1/2022 0:00900379521
C1/1/2022 0:00300100200
C11/1/2022 0:002000200
C12/1/2022 0:001000100

 

 

1 ACCEPTED SOLUTION

@dw700d Try:

Count of Profit Circuit version 2 =
COUNTROWS(
    FILTER(
        SUMMARIZE(
            'Inventory',
            [Circuit #],
            "_Profit", SUM(Inventory[Profit])
        ),
        [_Profit] > 0
    )
)


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...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@dw700d Try:

Measure =
  COUNTROWS(
    FILTER(
      SUMMARIZE(
        'Table',
        [Circuit],
        "__Profit", SUM('Table'[Profit])
      )
      [__Profit] > 0
    )
  )


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...

@Greg_Deckler   thank you for your help. I am not quite sure what I am doing wrong. Any thoughts

dw700d_0-1683301654148.png

 



 
Count of Profit Circuit version 2 =
COUNTROWS(
    FILTER(
        SUMMARIZE(
            'Inventory',
            [Circuit #],
            "_Profit", SUM(Inventory[Profit])
        )[_Profit], SUM(Inventory[Profit])
    )
    [_Profit] > 0
)
)

@dw700d Try:

Count of Profit Circuit version 2 =
COUNTROWS(
    FILTER(
        SUMMARIZE(
            'Inventory',
            [Circuit #],
            "_Profit", SUM(Inventory[Profit])
        ),
        [_Profit] > 0
    )
)


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...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors