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

How to write a Dax measure using the date table with mutable IF conditions

Dear All,

 

I need help in writing a Dax measure using the date table with mutable IF conditions as below:

 

I need two measures  :

 

1- (total days btween the date that I'll select in the silcer and the employee Hire Date  + the Extra days / 365 ) now we will have the years of employment for each in a measure or a coulmn, now in other measure or the same one if the years >=18 I need to return 100% if it's >=15 return 75% if >=12 return 50% if >=9 return 25% other return 0

 

if the employee hire date is 01-01-2010 and the slicer date is 01-01-2023 he will have 13 years then he will be 50%, if the slicer date is 01-01-2027 he will have 17 Years then he will be 75%

 

2- the other measure is the easy one if we complete the above, it will take the years of employment * the Salary * the above mesure % 100% or 75% or 50% or 25%.

 

thank you for your help in advance 

please find the below data to be used:

 

NameHire DateSalaryExtra Days
Name 16/1/2000 0:0030000
Name 26/1/2000 0:0025000
Name 36/1/2000 0:0040000
Name 412/13/2010 0:0025001065
Name 54/24/2011 0:0025000
Name 64/28/2011 0:0015000
Name 75/1/2011 0:0040000
Name 85/24/2011 0:0035001840
Name 96/7/2011 0:007000
Name 107/3/2011 0:008000
Name 117/10/2011 0:0012000
Name 128/1/2011 0:005001640
Name 139/11/2011 0:009500
Name 1410/4/2011 0:0018000
Name 155/4/2014 0:0014000
Name 166/10/2014 0:0016600
Name 175/8/2016 0:0058900
Name 185/22/2016 0:006500
Name 195/23/2016 0:008500
Name 206/1/2016 0:009540
Name 216/12/2016 0:0036500
Name 227/12/2016 0:008000
Name 237/17/2016 0:009000
2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Please find attached my PBI solution file.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

lbendlin_0-1686446729948.png

 

see attached

 

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

April Fabric Community Update

Fabric Community Update - April 2024

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

March 2024 PBI Gallery Image

Power BI Monthly Update - March 2024

Check out the March 2024 Power BI update to learn about new features.