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
MattN4
Helper I
Helper I

RANKX positive to Negative

Hi,

 

When using the RANKX formula I get a gap between postive an negative numbers. How can I overcome this?

 

Measure is as follows;

 

Rank = RANKX(ALLEXCEPT(SPER,SPER[Region]),'Sales'[Var to Target],,DESC,Dense)

 

Gives me

 

RegionVar to TargetRank
A5%1
B1%2
C-1%4
10 REPLIES 10
Anonymous
Not applicable

I ******* solved it at last. 

The problem is that when you filter, your measure returns "0" values, which negative numbers count after.

 

What you need to do is to apply a formula like to ignore blanks in your filter column like:

 

Filter(Allselected('Tablename'[Columnname]),[Measure]<>blank())

 

Let me know if this works for you guys. 

tex628
Community Champion
Community Champion

Do you want to filter region by top values in Var to Target?


Connect on LinkedIn
Anonymous
Not applicable

tex628
Community Champion
Community Champion

@Anonymous , 

Can you give a brief explaination of the issue, maybe provide some images and expected outcome? 

/ J


Connect on LinkedIn
Anonymous
Not applicable

Hi @tex628 

 

Same below problem what @MattN4   getting:

 

RegionVar to TargetRank
A5%1
B1%2
C-1%4

 

rank value was skipping  when negative value starts in var to target column..

tex628
Community Champion
Community Champion

Generally speaking the solution to this is changing the ALLEXCEPT to an ALLSELECTED. Try that to begin with and can you post the current code of your ranking measure?
 
/ J


Connect on LinkedIn

Thanks, I can't share the pbix as it contains sensitive data.

 

Yes, there will be a filter. Basically in each region there would be several entries.

tex628
Community Champion
Community Champion

Try simply using the integrated topN filter on region with "Val to Target" in "by value"

 

image.png


Connect on LinkedIn

Manged to sort it by selecting ALLSELECTED opposed to ALLEXCEPT.

 

Thanks for your input.

v-danhe-msft
Employee
Employee

Hi @MattN4,

Based on my test, I got the correct result like the below picture, and I could not find your problem.

1.PNG

To find the cause as soon as possible, I would suggest you share pbix file if possible. If the report does contain sensitive data, please upload your report to your OneDrive and send the link to me via private message.

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/r5zwighxdabok36/RANKX%20positive%20to%20Negative.pbix?dl=0

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.