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
eddya
Frequent Visitor

Rank New Items Only

Hi,

 

I have added a column to a basic sales table in order to tag items with a first sale date within 4 months as "New", with the rest as "Old". I would like to rank only the items which are "New". I've tried numerous options involving the FILTER function, however none are working. 

 

Here is my latest attempt:

 

New Items Rank = RANKX(ALL(Sales[ProductID]),CALCULATE(SUM(Sales[Units]),Sales[Status] = "New"),,DESC,Dense)
 
Any assistance is appreciated.
 
Thank you!

 

 

1 ACCEPTED SOLUTION

Hey,

 

maybe you have to adjust this part

...
,ALL(Table1[Category])
...

of the above DAX statement to amore elaborated one, like so

,,,
,ALL(Table1[Category],Table1[column ...], ...)
...

If this will not work you may want to share a pbix with sample data, upload the pbix to onedrive or dropbox and share the link.

 

Regards,

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey,

 

I have this sample data:

image.png

 

and created this measure:

Rank just new categories = 
IF(SELECTEDVALUE(Table1[Status],BLANK()) = "New"
    ,RANKX(
        CALCULATETABLE(
            FILTER(
                'Table1'
                ,'Table1'[Status] = "New"
            )
            ,ALL(Table1[Category])
        )
        ,CALCULATE(SUM(Table1[Amount]))
        ,
        ,ASC
    )
    ,BLANK()
) 

Now I'm able to create this table:

image.png

 

Hopefully this is what you are looking for.

 

Regards,

Tom

 

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

@TomMartens Thank you for your reply, however everything is now being ranked as "1".

Hey,

 

maybe you have to adjust this part

...
,ALL(Table1[Category])
...

of the above DAX statement to amore elaborated one, like so

,,,
,ALL(Table1[Category],Table1[column ...], ...)
...

If this will not work you may want to share a pbix with sample data, upload the pbix to onedrive or dropbox and share the link.

 

Regards,

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.