Forum Discussion
TJK
2 years agoHelper I
DAX Calculated Column in the Table View
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 ex...
- 2 years ago
TJK Try this:
Column = VAR __Company = [Company] VAR __Table = DISTINCT( SELECTCOLUMNS( FILTER( 'Table', [Company] = __Company ), "Lender", [Lender] ) ) VAR __Result = COUNTROWS( __Table ) RETURN __Result - 2 years ago
Thanks Greg! I was able to solve it with the following too:
Column =CALCULATE(DISTINCTCOUNT('Table'[Lender]),ALLEXCEPT('Table','Table'[Company]))
Greg_Deckler
2 years agoCommunity Champion
TJK Try this:
Column =
VAR __Company = [Company]
VAR __Table = DISTINCT( SELECTCOLUMNS( FILTER( 'Table', [Company] = __Company ), "Lender", [Lender] ) )
VAR __Result = COUNTROWS( __Table )
RETURN
__ResultTJK
2 years agoHelper I
Thanks Greg! I was able to solve it with the following too:
Column =
CALCULATE(DISTINCTCOUNT('Table'[Lender]),ALLEXCEPT('Table','Table'[Company]))