Forum Discussion

jussiwaisto's avatar
jussiwaisto
Icon for Helper I rankHelper I
7 years ago

Select the only the smallest value from table

Hi,

 

I have simple table where I have three columns, Name, ID and Value. 

 

The name means name of customer and I'm only interested the customers first (smallest) value in table (in this case Id 3). So if customer have many rows I would like to print only the first one.

 

 

The result should look like this:

 

What is the easiest way to do this? Thank you!

5 Replies

  • Hi jussiwaisto ,

     

    Try using the followin measure:

     

     

    First Name =
    CALCULATE (
        FIRSTNONBLANK ( Table1[Value]; 1 );
        FILTER ( ALL ( Table1[ID] ); Table1[ID] = MIN ( Table1[ID] ) )
    )

    Regards,

     

    MFelix

    • jussiwaisto's avatar
      jussiwaisto
      Icon for Helper I rankHelper I

      Thanks for answering, but it didn't work..! I think I have to update my description of problem:

       

    • MFelix's avatar
      MFelix
      Icon for Super User rankSuper User

      Hi jussiwaisto ,

       

      Measures are based on context so when you add the ID column to your table visual you are adding more context so the result is different add also for the ID the following code:

       

      First Name =
      CALCULATE (
          FIRSTNONBLANK ( Table1[ID]; 1 );
          FILTER ( ALL ( Table1[ID] ); Table1[ID] = MIN ( Table1[ID] ) )
      )

      Regards,

      MFelix

      • jussiwaisto's avatar
        jussiwaisto
        Icon for Helper I rankHelper I

        Thank you MFelix, I think i did just like you said but didn't work - here are few more screenshots:

         

        The measure:

         

        Then I have a date slicer:

         

        And result table where is still two "Jukka" results eventhough i would like to get only the first (id: 412110):

         

        Is there something i did wrong? :)