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
Anonymous
Not applicable

RANKX by two columns

Hi,

 

I'm trying to rank my data making use of 2 dimensions that is 'Product Family' and 'Fiscal Qtr' since I need the top 10 values based on the Fiscal Qtr. I'm trying to put this measure on the visual filter.

 

I created a measure to rank all data irrespective of the fiscal quarter using

 

		Rank_WITH_ALL =
		RANKX (
			ALL ( AIO_Sample[Product Family] ),
			CALCULATE ( [ASP Impact_Latest] ),
			,
			ASC,
			SKIP
		)

 

The result:

 

Untitled.png

 

Now when I try to pass the Fiscal Quarter="FY2021Q4 condition using

Rank_WITH_ALL2 =
RANKX (
    FILTER (
        ALLSELECTED ( AIO_Sample[Product Family], AIO_Sample[Fiscal Qtr] ),
        AIO_Sample[Fiscal Qtr] = "FY2021Q4"
    ),
    CALCULATE ( [ASP Impact_Latest] ),
    ,
    DESC,
    DENSE
)

 

The Result: I get 15 Product Families even though I selected "10" in the filter. What am I doing wrong?

Untitled.png

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

Can you please share some dummy data with a similar data structure and expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous , Try like

 

Rank_WITH_ALL2 =
RANKX (
ALLSELECTED ( AIO_Sample[Product Family], AIO_Sample[Fiscal Qtr] ),
CALCULATE ( [ASP Impact_Latest] , filter(AIO_Sample, AIO_Sample[Fiscal Qtr] = "FY2021Q4" )),
,
DESC,
DENSE
)

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.