Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
4 years ago

Last 5 items and average per row

Hello!!! I need your help!!

I have the following table

I need to create a dax measurement that calculates the percentage of the average for each row. I tried several times and it seems simple but it doesn't work out.
On the other hand I need to create a measure that indicates the average percentage of the last accounting years that is, it must contain the Ejc 56 to EjC52 but it must be dynamic so that when new ones are added I take them into account.
If you can help me please!!!
Thanks a lot.

5 Replies

  • Syndicate_Admin 

    you can try this

    Measure =
    VAR _max=max('Table'[YEAR])
    VAR _min=_max-4
    return averagex(FILTER('Table','Table'[YEAR]>=_min&&'Table'[YEAR]<=_max),'Table'[VALUE])
     
    if the year column can't be used, you can create an index column
     
    pls see the attachment below
    • Syndicate_Admin's avatar
      Syndicate_Admin
      Icon for Administrator rankAdministrator

      Hello, thanks for replying!.
      My table doesn't have a date column, so I can't use the measurement that happens to me.
      Thank you.

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Icon for Administrator rankAdministrator

      Hello!! I couldn't fix my problem but his answer gave me a guide, but I'm still with the problem. I'm going to post again with the pbi file to make it better understood. Thank you.

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

      Syndicate_Admin 

      can you use the second column? It looks like year column.

      If that column is not continuous number, you can use an index column and use index column to calculate.