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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Islam
Helper V
Helper V

Need Help with complex dax formulas

hello Everyone 

this is a sample file for what i need and i explained every thing in a text box in the file and i need help 

 

and to summerize what i need exactly is that i have two date in two different tables and an initiate value in the fact table which has relationships with both other tables and i wanna based on camparing the two dates in the two tables to generate the new value based on result of dates comparison and extracted from the initiate value in the fact table

 

and here is the sample file

https://drive.google.com/file/d/1jlbkikkQfscIu4BO1bx3TnvAKMeORW3B/view?usp=sharing 

8 REPLIES 8
lbendlin
Super User
Super User

"the initial wage or base wage which i enter manually for each employee"

 

How are you planning to do that in Power BI?

Can I contact you privately sir ?

I've no ideabut I decided to put each employee base wage in employee basic details table and then calculate each raise by it's value percentage

 

 

Hi @Islam ,

Based on my understanding, I compare the Decision Apply Date with the DecImpDate. And wages increase at a rate of 50% per year. If this is not the output you expect, please describe it in more detail.

NewWage = 
var DateDiff = 
  DATEDIFF(
    MAX(dtblassignmentDec[Decision Apply Date]),
    MAX(dtblRegularAdds[DecImpDate]),
    YEAR
  )
return 
  MAX(FTransactions1[Wage]) * POWER( 1.5, DateDiff )

v-kkf-msft_0-1614737219186.png

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

 

I'll mention you in the more explained post

Hi @Islam ,

Try the following formula:

 

Wage growth = 
VAR MinDate =
  MINX ( 
    ALLSELECTED ( dtblassignmentDec[Decision Apply Date] ), 
    dtblassignmentDec[Decision Apply Date] 
  )
VAR currentyear =
  YEAR ( MAX ( dtblRegularAdds[DecImpDate] ) )
var YearDiff = 
  currentyear - YEAR(MinDate)
var _year = 
  IF(
    MAX(dtblRegularAdds[DecImpDate]) >= EDATE(MinDate,YearDiff*12),
    YearDiff,
    YearDiff-1
  )
VAR growthRate = 
  SUM(dtblRegularAdds[PromotionRate])
VAR Result =
  SUM ( dtblBasicEmpInfo[Wage] ) * ( 1 + growthRate ) ^ _year
RETURN
  Result

 

image.png

This is my PBIX file.

https://microsoftapc-my.sharepoint.com/:u:/g/personal/v-lazhang_microsoft_com/ES3gq095kdxOuUztsFMK16...

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

 

 it's almost correct but unfortunately both employees got the regular add although one of them has a date differnce between his assigning date and regular add date equals to less than a year

like following picture

1.png

sure sir I'll inforn you with result and sry for sending you the explaination privately because I couldn't type it here due to site html restrictions

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors