cancel
Showing results for
Did you mean:
Helper IV

## Count based on condition

Hi Community,

I want to count organization based on “Decision”, I have used below formula and it not showing right result.

Count =
COUNTX(

FILTER ( 'Raw Data',' Raw Data '[Decision] = "Award" ),

''Raw Data''[organization])

 Raw Data Organization Decision ABC Award ABC Award ABC Decline XYZ Award

 Final Result Organization Decision Count only based on Awarded ABC Award 2 XYZ Award 1

1 ACCEPTED SOLUTION
Super User III

Create a Calculated Column

``Column = CALCULATE(COUNT(Table2[Decision]),FILTER( ALLEXCEPT(Table2,Table2[Organization]), Table2[Decision] = "Award"))``

Regards,
Harsh Nathani

Appreciate with a Kudos!! (Click the Thumbs Up Button)

13 REPLIES 13
Continued Contributor
Try This:

Count = CALCULATE(COUNTROWS('Raw Data'),'Raw Data'[Decision]="Award")
Helper IV

@swise001  I have used your suggestion and still not getting right number.

 Count only based on Awarded 1 1
Super User II

I replicated your scenario and your measure displays the correct result. Below is the pbix file.

Thank you,
Antriksh Sharma
Helper IV

@AntrikshSharma thank you so much.I am trying to create in calculated column and i want to use column result to next formula.

Super User II

If it is a calculated column then you can use this. Modify the IF statement as per your requirement.

``````Column =
VAR CurrentOrganization = RawData[Organization]
VAR RowsSatisfyingCondition =
COUNTROWS (
FILTER (
RawData,
RawData[Organization] = CurrentOrganization
&& RawData[Decision] = "Award"
)
)
VAR Result =
IF ( RawData[Decision] = "Award", RowsSatisfyingCondition )
RETURN
Result
``````

Thank you,
Antriksh Sharma
Helper IV

@AntrikshSharma sorry still not getting the right result.

Super User III

Create a Calculated Column

``Column = CALCULATE(COUNT(Table2[Decision]),FILTER( ALLEXCEPT(Table2,Table2[Organization]), Table2[Decision] = "Award"))``

Regards,
Harsh Nathani

Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helper IV

Thank you so much one for your great suggestions.

Super User II
You said you are trying to create a calculated column and what you have in the image is a measure.

Thank you,
Antriksh Sharma
Helper IV

@AntrikshSharma  no it is column.Thanks

Super User II

I would use

_Count =

CALCULATE(COUNTX('Raw Data'[organization]), ALLEXCEPT('Raw Data','Raw Data[Decision]))

(OR)

CALCULATE(COUNTROWS('Raw Data'),'Raw Data'[Decision]="Award")

Did I resolve your issue? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!

Regards,
Pranit

Super User II

I believe what you are looking for is below:

CALCULATE (
COUNTROWS('Raw Data'),
FILTER ( ALLEXCEPT('Raw Data','Raw Data'[Decision]),'Raw Data'[Decision]="Award")
)

Did I resolve your issue? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!

Regards,
Pranit

Helper IV

Thank you so much Pranit, I have used your suggestion but result is still not right.

 Count only based on Awarded 2411 2411

Announcements