Forum Discussion

vbourbeau's avatar
vbourbeau
Resolver II
7 years ago
Solved

Rankx return empty value

Hi,

 

I have a matrix where I want to return the rank of my customer by total sales for a specific period.

I put this DAX

rank = rankx(ALLSELECTED(InvcDtl[Customer Name]);calculate(sum(InvcDtl[Total invoice amount])))
 
All work... my customer have their rank base on their sales. But when I change the time period  if some customers do not have sales for this period well the customer still there empty?
 
I don't want to see my old client?
 
Is some one can help?
 
 

15 Replies

  • mussaenda's avatar
    mussaenda
    Community Champion

    Maybe you can filter the blank in Filters Pane where mTotal Sales is not blank.

  • I realize that my date measure are on another table that InvcDtl. It's the reason why the rank took all my customer. But my date table are linked with my InvcDtl table? Why the Date filter won't apply?

    • vbourbeau's avatar
      vbourbeau
      Resolver II

      Ok I do a example see the attachment.

       

      the result give that

      ClienD and ClientE don't have any sales in 2016 but the table show them?

       

      If I remove my Rank measure the filter work ok.

       

      I don't know how to add my pbix so I create a link. https://we.tl/t-f0OQ4nhFOm

       

       

      • v-danhe-msft's avatar
        v-danhe-msft
        Microsoft Employee

        Hi vbourbeau ,

        Based on my test, you could refer to below formula:

        Rank = IF(CALCULATE(SUM(Line[amount]))=BLANK(),BLANK(),rankx(ALLSELECTED(Line[Client]),CALCULATE(SUM(Line[amount]))))

        Result:

        Regards,

        Daniel He

    • vbourbeau's avatar
      vbourbeau
      Resolver II

      Thank you

       

      Do you know if it's my dax the problem, because if the date are in the same table as the invoice the problem don't occure? kind of relationship with both table?

       

    • vbourbeau's avatar
      vbourbeau
      Resolver II

      Hi,

       

      With my true data when I apply the filter the matrix give me this error:

      there's not enough memory to complete this operation

      I restart my computer and nothing.

      Without the filter the matrix run in a sec.