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

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

Reply
danextian
Super User
Super User

Count number of instance based on multiple criteria

Hi All,

 

I've been trying to solve this on my own but  I just can't get the right DAX

 

Here's my scenario:

 

For each transaction type, the employee should meet the following mix -

 

transction type mix by employeeCount
Transaction Type 12
Transaction Type 21

 

This is going to be on a per month basis. If this mix is not hit by employee and by month, value should be "did not meet" else "did meet"

 

Here is a sample data - 

MonthEmployeeTransaction TypeCount
JanA1A
JanB1A
JanC1A
JanD1A
JanA2A
JanB2A
JanC2A
JanD1A
JanA2A
JanB2A
JanC2A
JanD2A
FebC1A
FebB1A
FebC1A
FebD1A
FebA2A
FebB2A
FebC2A
FebD1A
FebA2A
FebB2A
FebC2A
FebD2A

 

The resulting remarks should be something like this - 

MonthEmployeeType 1 Type 2Grand Totalremarks
JanA123did not meet
 B123did not meet
 C123did not meet
 D213did meet
FebA 22did not meet
 B123did not meet
 C224did not meet
 D213did meet

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
8 REPLIES 8
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @danextian

 

Please try the following 4 calculated measures:

 

Type 1 = CALCULATE(COUNTROWS('Transactions'),'Transactions'[Transaction Type]="1")

Type 2 = CALCULATE(COUNTROWS('Transactions'),'Transactions'[Transaction Type]="2")

Grand Total = [Type 1] + [Type 2]

Remarks = IF([Type 1]>=2 && [Type 2]>=1,"did meet","did not meet")

 

pp.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi Phil,

 

Thanks for the reply. I tried this but it did not work. The measure calculates based on the whole data instead of a, for example, per criteria (by employee, by month). Since, for  the whole, the count for type 1 is not equal to 1 and for type 2 not equal to 2, the result is "did not meet".





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian

 

Are the [type 1] and [type 2] measures ok and it's just the [result] measure that is wrong?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark

 

Type 1 and Type are both okay - they both show the correct count. However, the calculated column is showing undesired result.]

 

If

Employee A

Type 1 = 2

Type 2 = 2

 

Then remarks = "did not meet"

Both criteria should be met. For this to be "did meet"  type 2 should be 1.  Cannot be less or equal than the set criteria.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

PS: Both criteria should be met to have a "did meet" result.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian

 

If the [Remark] calculated measure needs to be an exact match you could try this

 

Remarks = IF([Type 1] = 2 && [Type 2] = 1,"did meet","did not meet")

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

Thanks again for the prompt response. However, this still did not  work. It seems that this calculated column does not filter on a per employee and per month basis. I created the following matrix:

 

Row - Employee

Column - Trasaction Type

Value  =  Count of Transactions

 

 

The matrix shows that Employee A has 2 Type 1s and 1 Type 2s. Given the logic, this should have resulted to "did meet" but have not. 

 

I think we can use some sort of "x" function but not sure what the correct formula would be.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thanks. I will try this out.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.