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
toneradeu
New Member

Using COUNTROWS to find the amount of times the given [Code] appears in a table

Greetings, I started using Power BI recently, so I don't have experience in DAX, and i'm stuck in a problem that i can't really think of a solution.

 

  • I have this gigantic table called 'fResponsib' which have a Column named [Responsibility_Name].
  • I also have a Table called 'DimEnt', which has 2 columns: [Code] and [Flag].
  • I need to create an column called [Qty] in 'DimEnt, which is the sum of all the times [Code] has appeared in [Responsibility_Name].
  • Both [Code] and [Responsibility_Name] are text-values.

Here's what i had in mind:

 

CodeFlagQty
F4XX45Type-A813
F4XX06Type-B755
F4XX15Type-C9
F4XX87Type-D114
F4XX33Type-E887
 Other33133

 

What I tried to do:

Qty = COUNTROWS( CALCULATETABLE('fResponsib', CONTAINSSTRING('fResponsib'[Responsibility_Name],'DimEnt'[Code])))

 

What should I do in this situation?
Thanks in advance!

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@toneradeu 

Can you try this as a new column?

Qty = 
COUNTROWS( 
    FILTER(
        'fResponsib',
        CONTAINSSTRING('fResponsib'[Responsibility_Name],EARLIER([Code]))
    )
)

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@toneradeu 

Can you try this as a new column?

Qty = 
COUNTROWS( 
    FILTER(
        'fResponsib',
        CONTAINSSTRING('fResponsib'[Responsibility_Name],EARLIER([Code]))
    )
)

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.

Top Solution Authors