Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
So I am trying to create another column where its summarising data like a pivot. Current data is as below:
Fruit | User |
Pear | User 1 |
Pear | User 2 |
Pear | User 1 |
Apple | User 3 |
Apple | User 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
Fruit | User | # of users |
Pear | User 1 | 3 |
Pear | User 2 | 3 |
Pear | User 3 | 3 |
Apple | User 4 | 2 |
Apple | User 5 | 2 |
Solved! Go to Solution.
@AS123
Add a column as follows:
New Col = CALCULATE( COUNTROWS( table17 ) , ALLEXCEPT( Table17,Table17[Fruit] ) )
How it works:
COUNTROWS( Table17 )
: This part of the formula calculates the total number of rows in Table17
.
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.
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.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Thank you, that worked like magic!
@AS123
Add a column as follows:
New Col = CALCULATE( COUNTROWS( table17 ) , ALLEXCEPT( Table17,Table17[Fruit] ) )
How it works:
COUNTROWS( Table17 )
: This part of the formula calculates the total number of rows in Table17
.
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.
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.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
87 | |
65 | |
50 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |