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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
misterlau14
Helper I
Helper I

Calculate the rank based on number of times a value occurs in a column (excluding specific values)

Hi everyone, I'd like to receive some assistance please

 

Background

I have a column of Occupation data that contains various reported responses.

 

New column created

So far, I have created a new column that counts the number of times each reported response occurs in the 'Occupation' column.

Count_Occupation =
COUNTROWS(
    FILTER('ALL Arrivals data', 'ALL Arrivals data'[Occupation] = EARLIER('ALL Arrivals data'[Occupation])))
 
This new column produces the correct output as required, so no issues here.

Ideal output

I would like to create a new column (or a new measure) that calculates the rank (based on the count of the number of times that each reported response occurs in the 'Occupation' column) - however it has to exclude the following reported responses:

  • Not Stated
  • Not Previously Employed

What I have created so far

I have currently created a new column called Rank_Count_Occupation that calculates the rank, however it does not exclude the 2 responses mentioned above.

 

Rank_Count_Occupation =
RANKX('ALL Arrivals data',('ALL Arrivals data'[Count_Occupation]),,DESC, Dense)
 
This is the current output in a table:
RankingOccupationNumber of arrivals
1Not Stated4891
2Non Working Child4522
3Not Previously Employed4114
4Occupation Unknown3526
5Home Duties1846
 
However, the output I am wanting is in this table below:

RankingOccupationNumber of arrivals
 Not Stated4891
1Non Working Child4522
 Not Previously Employed4114
2Occupation Unknown3526
3Home Duties1846

Seeking your assistance
I think I'm 80% of the way there with the new columns I have created up to this point but need to add in one last thing to the current DAX code to exclude the 'Not Stated' and 'Not Previously Employed' responses.
 
Can someone please help me with how to go about creating a new column (or a new measure) to obtain the required output (in purple text) in the second table above?

Thanks all
1 ACCEPTED SOLUTION

Hi,

This measure works

Measure 1 = RANK(DENSE,FILTER(ALL('ALL Arrivals data'[Grouping_Occupation]),'ALL Arrivals data'[Grouping_Occupation]<>"Not stated"&&'ALL Arrivals data'[Grouping_Occupation]<>"Not previously employed"),orderby([Count_Occupation_],DESC))

Hope this helps.

Ashish_Mathur_0-1729048291279.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Power BI file - Occupation data only 

 

Hi, please see above link.

Thanks

Hi,

This measure works

Measure 1 = RANK(DENSE,FILTER(ALL('ALL Arrivals data'[Grouping_Occupation]),'ALL Arrivals data'[Grouping_Occupation]<>"Not stated"&&'ALL Arrivals data'[Grouping_Occupation]<>"Not previously employed"),orderby([Count_Occupation_],DESC))

Hope this helps.

Ashish_Mathur_0-1729048291279.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you so much for your help - your measure did the job nicely 🙂

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.