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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

2 String Columns(A & B), Need to Count Result in B based on A

Hi,

I'm very new to DAX in general and come from a C# background (Nothing Alike Man Happy )

 

I have a table with the following Columns:

ID - Int

DateTimeCreated - DateTime

EventSource - Varchar

EventType - Varchar

Description - Varchar

ClosingTime - Time

Status - Varchar

 

The data would typically look as follows:

 

BoxLocks.JPG

 

I would like to have a count for how many times an EventSource is Locked/Unlocked. Example in data provided Box 20 Lock has a Locked count of 3

 

Your help is appreciated.

 

Thank you

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Please try the following formula to create calculated columns.

Lock=CALCULATE(COUNTA(Table[status]),FILTER(ALLEXCEPT(Table,Table[EventSource]),Table[status]="locked"))

Unlock=CALCULATE(COUNTA(Table[status]),FILTER(ALLEXCEPT(Table,Table[EventSource]),Table[status]="unlocked"))


If you have other issues, don't hesitate to let me know.

Best Regards,
Angelia

View solution in original post

2 REPLIES 2
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Please try the following formula to create calculated columns.

Lock=CALCULATE(COUNTA(Table[status]),FILTER(ALLEXCEPT(Table,Table[EventSource]),Table[status]="locked"))

Unlock=CALCULATE(COUNTA(Table[status]),FILTER(ALLEXCEPT(Table,Table[EventSource]),Table[status]="unlocked"))


If you have other issues, don't hesitate to let me know.

Best Regards,
Angelia

Anonymous
Not applicable

Thanks a lot!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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.