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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors