Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Meirieli
New Member

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.

 

 

Duvida Rating.png

2 REPLIES 2
Greg_Deckler
Super User
Super User

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


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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).

 

Modelo.PNG

 

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.

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.