Forum Discussion

tulsi's avatar
tulsi
Helper I
7 years ago
Solved

Top 2 tasks by month

Hi,

 

I have to get top 2 tasks by month starting from august 2017-now. When I'm using the top n filter it's giving me common top 2 tasks for all the months. I need top 2 tasks for that particular month.

Data source looks something like this:

datasource

  • Hi tulsi

     

    You may try to add a rank measure as below. Then drag it to visual level filter and set the measure is less than or equal to 2. If it is not your case, please share some data sample.

    Rank =
    RANKX ( ALL ( Table[task name] ), CALCULATE ( SUM ( Table[Qty] ) ) )

    Regards,

    Cherie

11 Replies

  • themistoklis's avatar
    themistoklis
    Community Champion

    tulsi

     

    First create the measure based on your required field:

     

    measure_new = CALCULATE(SUM(TableName[Amount]),ALLEXCEPT(TableName, TableName[ID]))

     

    Then create another measurethat will be used in the filtering section (Top N lest say countries)

     

    RANK=RANKX(ALLSELECTED(TableName),[measure_new],,DESC,Dense)

     

    Finally, create a table object, select the [ID], measure [measure_new] as value levels. Add the measure [RANK] as Visual level Filters, let the RANK value is less than or equals to 2.

    • tulsi's avatar
      tulsi
      Helper I

      So the measures that I have created are;

      Measure1 = CALCULATE(SUM('all'[Qty]),ALLEXCEPT('all','all'[Task Name]))

      Measure 2 = RANKX(ALLSELECTED('all'),[Measure1],,DESC,Dense) 

       and I created a table just like you mentioned with the filters i'm getting something like this:

      But I need to get top 2 tasks for that particular month, here it's just showing overall top 2 tasks