Formula to find the second different text in a column

pbiexpert 21 Reputation points

Hey Folks,
I managed to find the first text value in a column with this dax formula:
firsttextvalue = TOPN(1,VALUES('table'[columnname])) --> TOPN because my table is already organized
what is the formula to find the second text value in the same column? I do not mean the second row value, because there is no information which row contains the next different text.

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,248 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,408 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lz._ 8,991 Reputation points

    Hi @pbiexpert

    Assuming problem understood


    SecondTextVal :=
    VAR FirstTextVal = [firsttextvalue] // Your existing measure
    TOPN ( 1, VALUES ( 'table'[columnname] ) ),
    FILTER ( 'table', 'table'[columnname] <> FirstTextVal )

2 additional answers

Sort by: Most helpful
  1. Lukas Yu -MSFT 5,816 Reputation points


    From the top function you used , did you mean that you want to find the second biggest value in that column ?

    If so,
    You could try :

    If you want to dig deep for Nth value in a column you could try more sophisticated solution like this : display the top N elements


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    What can I do if my transaction log is full?--- Hot issues November
    How to convert Profiler trace into a SQL Server table -- Hot issues November

  2. pbiexpert 21 Reputation points

    Many thanks for your fast reply! Yes @Lz._ , your approach is the winning one, it gave me back exactly the second different text that I was looking for. The formula MINX did not work, I bet it is because I have text in the column and MINX is used for determining values. Thanks a lot! :)