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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

TOP 10(20,50,100...) products

Hi all,
I have filter witch contain "invoices" and "POS".

And also I have 4000 records (2000 for invoices and 2000 for POS).

I want get TOP X products with my filter. below is my filter code.

Rank = RANKX(ALL('current year'),'current year'[UnitsSold],,DESC)
when i am choose invoices it's work right.
pic1.PNG
But when I am choose POS it's shows only one row, but need to be 10 row(top 10) .
pic2.PNG
How can I fix?
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Nothing was changed ;\ ... but everything is ok, I just changed my sql. now I have two datasets and can rank  individually.

View solution in original post

8 REPLIES 8
hthota
Resolver III
Resolver III

Please use this:

 

Rankm1 = IF(HASONEVALUE(current year[valuetype]),
RANKX(ALL('current year'),'current year'[UnitsSold],,DESC),
BLANK()
)
 
It would help you.
Anonymous
Not applicable

@hthota , it's not work ;\

Try this:

 

Rankm1 = IF(HASONEVALUE(current year[valuetype]),
RANKX(ALL('current year'),'current year'[UnitsSold]),
BLANK()
)

Try this:

 

Rankm1 = IF(HASONEVALUE('current year'[valuetype]),
RANKX(ALL('current year'),'current year'[UnitsSold]),
BLANK()
)
Anonymous
Not applicable

Nothing was changed ;\ ... but everything is ok, I just changed my sql. now I have two datasets and can rank  individually.

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

Try the below

RANKX(
    ALL('current year'[UnitsSold]),
    'current year'[UnitsSold],,
    DESC,
    Dense
)

 

Regards,
Mariusz

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

Anonymous
Not applicable

@Mariusz , No it's doesn't work 😕

Hi @Anonymous 

Try the below.

VAR tbl = CALCULATETABLE( VALUES( 'current year'[UnitsSold] ), ALLSELECTED() ) 
RETURN 
RANKX(
    tbl,
    'current year'[UnitsSold],,
    DESC,
    Dense
)

Regards,
Mariusz

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.