cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors