Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Calculate table with top 1 value as variable

Hi guys,

 

Is it possible to use CALCULATETABLE using Top1 value as variable?

 

topwells = CALCULATETABLE('WellList', WellList[Operator] = Top 1 value from column

 

 

 

 

Thanks,

7 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks mahoneypat ,

       

      So, using the top n as a VAR and then add it to the equation?

       

      Would you be able to guide me a bit more?  i used:

       

       

      topwells = CALCULATETABLE('WellList', WellList[Operator] = TOPN(1, WellList, WellList[Operator]))

       

       but i got a :

      A function 'TOPN' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

       

       

      • mahoneypat's avatar
        mahoneypat
        Icon for Microsoft Employee rankMicrosoft Employee

        Can you provide some sample data?  For example, in what regard is the operator considered the "top"?  Alphabetically? Some measure results?

         

        Regards,

        Pat

         

  • v-alq-msft's avatar
    v-alq-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario.

    Welllist:

     

    You may create a calculated table as below.

    Table = 
    FILTER(
        'WellList',
        WellList[Operator] in TOPN(1,DISTINCT(WellList[Operator]),WellList[Operator])
    )

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      I would need to create a table for this right?

       

      I am trying to show only the values where the operator name = Max(Well list[Operator]), tis case i would like to chart just the 3 with XTO values