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

Urgent Help needed in Dynamic Ranking based on Date as a Measure.

Hello Dax Experts,

 

I need your urgent help!

 

First let me explain you about data.

 

I have a EmployeeTable. It consist of ID, EmployeeID , AssignementID, StartDate, EndDate, ExtensionNumber, TypeOfAssignment(Perm/Contract), HiredByOrganization, Profit/Loss. For employee, assignments also got extended. So for them there are multiple entries for employee for same assignment. 

 

Below is the user requirement:

 

User will select a SingleDate. The complete report should be running for that date. Whichever date is selected only the records which exist under below criteria should be considered.

 

StartDate> SelectedDate-60 (Should not be more then 60 days old from SelectedDate)

EndDate>=SelectedDate (Only non expired/finished Assignments)

 

For this I have created standalone table consisting date. I am picking the value of Date given by User with the help of SelectedValue function.

I have created a measure with the help of SELECTEDVALUE and when the above criteria is getting satisfied I am giving value as 1 or else blank. And I am giving this measure as a filter in my matrix or other measure using FILTER dax i.e. [Measure]>0 to fulfil above requirement and it is working completely fine.

 

I need to show the count of Employees for each Organisation in 2 categories i.e AssignmentEndingin2weeks and AssignmentEndinginmorethen2weeks (Needs to be calculated as per the Selected Date by user and AssignementEndDate). Also I need to drag Profit/Loss column in column field of my matrix.

For this I need to take the count of the Emoloyees. The above two categories of AssignmentEnding duration in weeks also depend on the Date Selected by user.

 

So first we need to create a calculated column which will be concatination EmployeeID and AssignmentID. Now we need to Rank this calculated column based on a AssignmentEndDate in descending order so that I will give this as a FILTER wherever required i.e Rank=1. I need to create it as a measure. As everything depends on the Date Selected by user Calculated Coumn will not work.

 

But I also need to take care of below criteria before giving rank.

 

StartDate> SelectedDate-60 (Should not be more then 60 days old from SelectedDate)

EndDate>=SelectedDate (Only non expired/finished Assignments)

 

I first need to fulfill above criteria and after that need to Rank. And will use this measure as Filter i.e [Measure]>0 wherever required.

 

I am badly stuck need your urgent help.

Thanks in Advance.

3 REPLIES 3
Greg_Deckler
Super User
Super User

Really need to have data for this one. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler ,

 

I have uploaded a sample data here.

https://uploadfiles.io/tus89lp8

 

Please let me know in case of any more information required.

Eagerly waiting for your help.

Anonymous
Not applicable

Hello @Greg_Deckler ,

 

Thanks for reply!

Will share sample data shortly.

 

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.