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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SriKandimalla
Helper I
Helper I

calculate COUNTROWS by filtering using a column of categories

Hello Power BI Community,

 

I am trying to write a dax column that calculates the COUNTROWS based on the categories in a different column. See the data at he end.

Column = (CALCULATE(COUNTROWS('tableName'),FILTER('tableName','tableName'[categories])))

I know the filter expression is wrong. But my intent is to countrows for each category separately.
 
Any ideas are greatly appreciated. TIA
namecategoriescount
cblue10
yblue10
yblue10
vblue10
iblue10
oblue10
rblue10
fblue10
ablue10
tblue10
rorange9
forange9
aorange9
torange9
gorange9
corange9
yorange9
yorange9
vorange9
ared11
tred11
gred11
cred11
yred11
yred11
vred11
ired11
ored11
rred11
fred11
vyellow10
iyellow10
oyellow10
ryellow10
fyellow10
ayellow10
tyellow10
gyellow10
cyellow10
yyellow

10

1 ACCEPTED SOLUTION
Nathaniel_C
Super User
Super User

Hello @SriKandimalla ,
If  I understand your issue, try this:

Countrows = CALCULATE(COUNTROWS(crow),ALLEXCEPT(crow,crow[categories]))

 crow is my table name.

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel

 





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

Proud to be a Super User!




View solution in original post

1 REPLY 1
Nathaniel_C
Super User
Super User

Hello @SriKandimalla ,
If  I understand your issue, try this:

Countrows = CALCULATE(COUNTROWS(crow),ALLEXCEPT(crow,crow[categories]))

 crow is my table name.

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel

 





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

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors