Forum Discussion

Meirieli's avatar
Meirieli
New Member
8 years ago

How to select Last December Rating from current data filtered?

Hi, guys.

 

On the model below, when I aplly one filter on my column date, one column need to return the rating of current month and other about last December. When I selected actual month, the rating it´s ok. But, the column with rating from last December about actual date selected is blank. Can someone to help me with that measure? Thanks!

 

Remember that Rating it´s based on column Grupo Economico. I have only one rating for each Grupo Economico and month/year.

 

 

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Well, no source data, no formulas posted, no table or table relationships but what the heck, I'll give it a shot. I would think that what you need to do is change your filter context, so something like:

     

    MAXX(FILTER(ALL(Table),[Month]="December" && [Year] = YEAR(TODAY())-1),[something])

     

    But who knows really provided the given information, I can only guess with regards to tables, columns, etc.. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    • Meirieli's avatar
      Meirieli
      New Member

      Oh, really! I´m sorry.

      It's my fault.

       

      My model it´s based on four tables, as below.

      DataBase (Date), RiscoOperacaoFinal (Column Rating), Cliente(Column Grupo Economico) and Carteira(fact Portfolio).

       

       

      The Column Rating It's like a good payer rating.

      The closer to A, the better paying.

       

      In my model, I need two columns:

       

      1 - select the classification Column Rating of customer based on data filter - year and month;

      2 - the classification Column Rating of customer based on last December about current selected date.

       

      Example:

       

      If I select April 2018, on column 1 a return the classification about that period and on column 2 a return the rating about December 2017.

       

      If I select May 2017, on column 1 a return the classification about that period and on column 2 a return the rating about December 2016.

       

      My actual DAX code from Column 1 is:

       

      Provisao Mes Atual =
      VAR Tbl2 =
          SUMMARIZE (
              FILTER (
                  Carteira;
                  Carteira[nr Ano Mes]
                      = IF (
                          ISFILTERED ( 'Data Base'[ano] ) && ISFILTERED ( 'Data Base'[nome Mes] );
                          Carteira[nr Ano Mes];
                          BLANK ()
                      )
              );
              'Risco Operacao Final'[cdRiscoNivel];
              "Provisao"; [ProvisaoTotal]
          )
      RETURN
          MAXX ( Tbl2; [Provisao] )
      RETURN
      MAXX(Tbl2;[Provisao])

       

      From column 2 that code doesn´t work.

       

      I hope this time I have been more clear and objective.

      Right away, thank you.