Forum Discussion
filter dimension tables and make calculation from different dimension tables
Hi Islam ,
Create the following measure:
Wage growth =
VAR MinimumYear =
MINX ( ALLSELECTED ( dtblRegularAdds ), YEAR ( dtblRegularAdds[DecImpDate] ) )
VAR currentyear =
YEAR ( MAX ( dtblRegularAdds[DecImpDate] ) )
VAR growthRate = 0.07
VAR Result =
SUM ( dtblBasicEmpInfo[Wage] ) * ( 1 + growthRate ) ^ ( currentyear - MinimumYear )
RETURN
Result
Result in attach PBIX and image below:
this is awesome bro but what about the date difference check
I mean only for test purpose i modified the assigning date to 1/6/2014 like next picture
then the difference between assigning date will be a year if compared to DecImpDate Like following picture
so the resulted regular add in 1/7/2015 should be 246*1.05 not just 246 like following picture
I'm sorry i can't understand this measure you provided but if you recommend any tutorials about this issue after modifying the measure to apply the date difference condition
sorry sir for bothering
- MFelix5 years ago
Super User
Hi Islam ,
Sorry but from you calculation in the first post I did not understood that the rate was different and that you had the different date check.
Try the following formula:
Wage growth = VAR MinimumYear = MINX ( ALLSELECTED ( dtblassignmentDec[Decision Apply Date] ), YEAR ( dtblassignmentDec[Decision Apply Date]) ) VAR currentyear = YEAR ( MAX ( dtblRegularAdds[DecImpDate] ) ) VAR growthRate = SUM(dtblRegularAdds[PromotionRate]) VAR Result = SUM ( dtblBasicEmpInfo[Wage] ) * ( 1 + growthRate ) ^ ( currentyear - MinimumYear ) RETURN Result- Islam5 years ago
Helper V
really appreciate it sir
just to confirm, is this measure testing the difference date between minimum date in both assigning date and regular adds date and the nearest uuper date to it and it is year or more then will calculate the regular add rate on the wage otherwise it displays only the previous wage ?
- Islam5 years ago
Helper V
Thanks sir i checked the file and i found the following
Assign apply date is 2/8/2014
First regular add date is 1/7/2015
So the difference between them is less than one year
Then the base wage shouldn't raise by the regular add of 2015 while in your suggested answer file it raised in 2015 which is not correct
I'm so sorry bothering sir
- MFelix5 years ago
Super User
Hi Islam ,
I'm a little bit lost about what is the calculation and how you are making it, because the calculations match the values you present on previous post.
Can you share a calculation with all this options so i can check what is the expected result the different cases, so when value is less than one year, and the percentage changes an so on.
Sorry for all the questions.