Forum Discussion

ArlenioPaiva's avatar
ArlenioPaiva
New Member
5 years ago

Help with Maxx and RANKX

Hi guys, I need some help to solve this problem. I want that the variable MaxRank returns the maximun value of variable rankeamento1.
How could i do that? I've tried many ways to put the right result but with no succes. My objetive is that rows that aren't between the LS and LI must be classified as the last one in this rank. Any idea how to solve that?

var Desvio = STDEVX.P(ALLSELECTED(fStatusInvest),[Total CAGR RECEITAS])


var Media = AVERAGEX(ALLSELECTED(fStatusInvest),[Total CAGR RECEITAS])

var Multiplo = [Total CAGR RECEITAS]

var LS = Media + 2.5*Desvio

var LI = Media - 2.5*Desvio

var rankeamento1 =
RANKX(
FILTER(
ALLSELECTED(fStatusInvest),
[Total CAGR RECEITAS] <= Media + 2.5*Desvio &&
[Total CAGR RECEITAS] >= Media - 2.5*Desvio &&
[Total CAGR RECEITAS] <> BLANK()),
[Total CAGR RECEITAS],
,
DESC,
Dense
)

var MaxRank = Maxx(fStatusInvest, rankeamento1)

Return IF(
Multiplo = BLANK(),
BLANK(),
IF(
Multiplo >= LS || Multiplo <= LI,
MaxRank,
rankeamento1
)
)


8 Replies

  • Hi ArlenioPaiva ,

     

    your explanation is not very clear about your data however believe that you need to do a summarize on your maxrank instead of linking the table directly something similar to this:

     

    MaxRank =
    MAXX (
        SUMMARIZE ( fStatusInvest, fStatusInvest[Column], "@Rankeamento", rankeamento1 ),
        [@Rankeamento]
    )

     

    Be aware that since I don't know your data granularity I only used a column but you must include in the summarize all the columns that make part of your context.

     

     

    • ArlenioPaiva's avatar
      ArlenioPaiva
      New Member

      First of All, thank you for your tentative.

      But i didnt have success with it.

       

      Could i share my project with you to see the problem?

       

      thank you

      • MFelix's avatar
        MFelix
        Super User

        Hi ArlenioPaiva ,

         

        Please do.

        Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

        If the information is sensitive please share it trough private message.

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Community Support

    Hi, ArlenioPaiva 

     

    Have your problem been solved? MFelix said is reasonable. If you still need help, Can you share some sample fake data and your desired result?So we can help you soon.

     

    Best Regards

    Janey Guo

    • ArlenioPaiva's avatar
      ArlenioPaiva
      New Member

      So, i havent solved yet.

       

      I will share with you, if you can help i will appreciate.

      How can i share? I tried here, but with no success