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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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