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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AS123
Regular Visitor

Need a to add a column for summarizing the data based on multiple filter similar to pivot

So I am trying to create another column where its summarising data like a pivot. Current data is as below:

FruitUser
PearUser 1
PearUser 2
PearUser 1
AppleUser 3
AppleUser 3

 

What I would like to show is how many users ate the fruit. I want to be able to do that by adding a new column. Any recommendations

FruitUser# of users
PearUser 13
PearUser 23
PearUser 33
AppleUser 42
AppleUser 52
1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@AS123 

Add a column as follows:

New Col = CALCULATE( COUNTROWS( table17 ) , ALLEXCEPT( Table17,Table17[Fruit] ) )


How it works:

  1. COUNTROWS( Table17 ): This part of the formula calculates the total number of rows in Table17.

  2. ALLEXCEPT( Table17, Table17[Fruit] ): This function is used to remove all filters from Table17 except for the ones applied to the 'Fruit' column. It retains only the filters related to the 'Fruit' column.

  3. CALCULATE( ..., ALLEXCEPT( Table17, Table17[Fruit] ) ): This function modifies the context in which the count of rows is calculated. It instructs DAX to count the rows of Table17 considering all filters except for those on the 'Fruit' column.

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

2 REPLIES 2
AS123
Regular Visitor

Thank you, that worked like magic!

Fowmy
Super User
Super User

@AS123 

Add a column as follows:

New Col = CALCULATE( COUNTROWS( table17 ) , ALLEXCEPT( Table17,Table17[Fruit] ) )


How it works:

  1. COUNTROWS( Table17 ): This part of the formula calculates the total number of rows in Table17.

  2. ALLEXCEPT( Table17, Table17[Fruit] ): This function is used to remove all filters from Table17 except for the ones applied to the 'Fruit' column. It retains only the filters related to the 'Fruit' column.

  3. CALCULATE( ..., ALLEXCEPT( Table17, Table17[Fruit] ) ): This function modifies the context in which the count of rows is calculated. It instructs DAX to count the rows of Table17 considering all filters except for those on the 'Fruit' column.

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
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!

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