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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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