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
hstgeorge
Helper III
Helper III

Looking to Rank Customers by Customer Name but exclude where the Customer Name Field is Blank

I have a data set that looks like the below:

 

CUSTOMER NAMEVOLUME
CUSTOMER A250
CUSTOMER B450
CUSTOMER C100
CUSTOMER D340
(BLANK)750

 

I want to rank the customers where the customer name is not Blank.

 

I am currently using the below formula:

 

rank toggle = RANKX(ALL(SecVol_TD[CHAIN NAME (groups)]),CALCULATE([PY_UCS plus Volume]*1),,DESC,Skip)
 
But this formula is keeping where the customer name blank so it's ranking the blank ones at 2 - I don't want to rank blank customer names.
2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@hstgeorge 

 

Please try below measures

total = sum(customer[VOLUME])

rank1 = 
if(SELECTEDVALUE(customer[CUSTOMER NAME])=blank(),"",
 RANKX(ALL('customer'),[total],,ASC))

1.PNG

Hope this is helpful.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

v-yiruan-msft
Community Support
Community Support

Hi @hstgeorge ,

Please try to update the formula of your measure as below:

rank toggle = 
IF (
    ISBLANK ( MAX ( 'SecVol_TD'[CHAIN NAME (groups)] ) )
        || MAX ( 'SecVol_TD'[CHAIN NAME (groups)] ) = "",
    "",
    RANKX (
        FILTER (
            ALLSELECTED(  'SecVol_TD'[CHAIN NAME (groups)] ),
            NOT ( ISBLANK ( 'SecVol_TD'[CHAIN NAME (groups)] ) )
                && 'SecVol_TD'[CHAIN NAME (groups)] <> ""
        ),
        CALCULATE ( [PY_UCS plus Volume] * 1 ),
        ,
        DESC,
        SKIP
    )
)

Rank.JPG

Best Regards

Rena

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

View solution in original post

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @hstgeorge ,

Please try to update the formula of your measure as below:

rank toggle = 
IF (
    ISBLANK ( MAX ( 'SecVol_TD'[CHAIN NAME (groups)] ) )
        || MAX ( 'SecVol_TD'[CHAIN NAME (groups)] ) = "",
    "",
    RANKX (
        FILTER (
            ALLSELECTED(  'SecVol_TD'[CHAIN NAME (groups)] ),
            NOT ( ISBLANK ( 'SecVol_TD'[CHAIN NAME (groups)] ) )
                && 'SecVol_TD'[CHAIN NAME (groups)] <> ""
        ),
        CALCULATE ( [PY_UCS plus Volume] * 1 ),
        ,
        DESC,
        SKIP
    )
)

Rank.JPG

Best Regards

Rena

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

Hi @hstgeorge ,

 

Apart from the solution given below you can try this measure.

 

 

1.jpg

 

 

Ranking Vol =
IF (
    MAX ( 'Table'[CUSTOMER NAME] )
        <> BLANK (),
    RANKX (
        FILTER (
            ALL ( 'Table'[CUSTOMER NAME] ),
            'Table'[CUSTOMER NAME]
                <> BLANK ()
        ),
        CALCULATE (
            SUM ( 'Table'[VOLUME] )
        )
    )
)

 

 

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

ryan_mayu
Super User
Super User

@hstgeorge 

 

Please try below measures

total = sum(customer[VOLUME])

rank1 = 
if(SELECTEDVALUE(customer[CUSTOMER NAME])=blank(),"",
 RANKX(ALL('customer'),[total],,ASC))

1.PNG

Hope this is helpful.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




mahoneypat
Employee
Employee

Have you tried using ALLNOBLANKROW() instead of ALL() in your RANKX expression?

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.