March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I want to create a calculated column in the Table View in Power BI. I want the calculated column to group the "Company" column based on how many unique values occur in the "Lender" column.
For example, the below table has 3 companies, and each company has two records of their lenders. Company1 has two different lenders, so I want the calculated column to list "2" for both of its records. Company2 and Company3 have the same lender listed twice, so I want the calculated column to list "1" for both of its records.
Company, | Lender, | Count of Lenders |
Company1, | Private, | 2 |
Company1, | Public, | 2 |
Company2, | Private, | 1 |
Company2, | Private, | 1 |
Company3, | Public, | 1 |
Company3, | Public, | 1 |
I know this is possible to achieve with Power Query, but can I achieve it in the Table View once the data is loaded out?
Solved! Go to Solution.
@TJK Try this:
Column =
VAR __Company = [Company]
VAR __Table = DISTINCT( SELECTCOLUMNS( FILTER( 'Table', [Company] = __Company ), "Lender", [Lender] ) )
VAR __Result = COUNTROWS( __Table )
RETURN
__Result
Thanks Greg! I was able to solve it with the following too:
Column =
@TJK Try this:
Column =
VAR __Company = [Company]
VAR __Table = DISTINCT( SELECTCOLUMNS( FILTER( 'Table', [Company] = __Company ), "Lender", [Lender] ) )
VAR __Result = COUNTROWS( __Table )
RETURN
__Result
Thanks Greg! I was able to solve it with the following too:
Column =
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
12 | |
9 | |
7 |
User | Count |
---|---|
38 | |
32 | |
25 | |
12 | |
11 |