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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Blue_BIGuy
Frequent Visitor

Rank customer over Date table for various slicer

Hello Experts, 

I am stuck with this issue and would like your guidance. 

 

I need to rank customer for selected PropertyName and Date (Date table, independent i.e. no relationship is maintain). 

Blue_BIGuy_0-1642503921535.png

There is a filter applied on the table which first check valid customer for selected date (calculation mention below), and then for these filtered customer I need calculate customer with top 3 Annual rent for selected PropertyName slicer.

I have two table Date and Detail - 

Blue_BIGuy_0-1642504359277.png

And Validity Check measure is derived as below - 

 IF(HASONEVALUE('Calendar'[Date]),IF(MAX(Details[RentStart])<=MIN('Calendar'[Date])&&MAX(Details[RentEnd])>=MAX('Calendar'[Date]),1,0),1)
 

Many thanks in advance. 

 

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @Blue_BIGuy 

Try this:

Rank =
RANKX(
    FILTER(
        ADDCOLUMNS( ALL( 'custom' ), "Validity Check", [DateCheck] ),
        [Validity Check] = 1
    ),
    'custom'[AnnualRent(M)],
    ,
    DESC,
    DENSE
)

If this doesn't work for you, please consider sharing a sample file without any sesentive information here, then I can try to look into it to come up with a more accurate measure.

 

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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-angzheng-msft
Community Support
Community Support

Hi, @Blue_BIGuy 

Try this:

Rank =
RANKX(
    FILTER(
        ADDCOLUMNS( ALL( 'custom' ), "Validity Check", [DateCheck] ),
        [Validity Check] = 1
    ),
    'custom'[AnnualRent(M)],
    ,
    DESC,
    DENSE
)

If this doesn't work for you, please consider sharing a sample file without any sesentive information here, then I can try to look into it to come up with a more accurate measure.

 

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

amitchandak
Super User
Super User

@Blue_BIGuy , If you have measure [Annual Rent] then you can top 3 customer like

 

calculate([Annual Rent],TOPN(3,allselected(table[customer]),[Annual Rent],asc), values(table[customer]))

 

How you would like date to play role ?

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hey Amit, 

If you need further details, so here the screen shot from my actual dataset, this might explain - 

Blue_BIGuy_0-1642577282763.png

I have created two measures first to check validity records (DateCheck) and other for Rank -

DateCheck =
IF(HASONEVALUE('Date'[Date]),IF(MAX('custom'[RentStart])<=MIN('Date'[Date])&&MAX('custom'[RentEnd])>=MAX('Date'[Date]),1,0),0)
Rank = RANKX(ALL('custom'[TenantName],'custom'[TradeSector], 'custom'[LeaseExpiryDate], 'custom '[RentStart],'custom'[RentEnd]), 'custom'[AnnualRent(M)], , DESC, Dense)
 
From screen shot you see if I select date as 31.12.2021 then there are only 2 records valid and I want to display top 10 valid tenant i.e. Top 10 tenant with Date Check field values as 1.
 
Thanks ! 
 

Thanks Amit, 

But the formual that you have provided is not working. 

 

My requirement is, to let user select any date and Property Name from slicer. For selected property name and date show top 10 valid customer (validity check is done based on this logic - rentStart <= Selected date and rentEnd >= Selected date) 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.