cancel
Showing results for
Did you mean:
Helper V

filter dimension tables and make calculation from different dimension tables

Hello Every one

I've attached a pbix test file

i have a fact table and three dimension tables

each of dimension tables has a relationship with the fact table

i wanna subtract minimum assigning date from nearest higher regular add date and get the difference rounded to year like follows

 difference regular add date assign date 0 01/07/2015 01/08/2014 1 01/07/2016 1 01/07/2017 0 01/07/2018

and in the previous table if it found out that difference is 1 year i wanna time the wage from basic employee details in add rate in regular adds table but i need it like comulative

for example if i have base wage of 246 pounds and i got three adds for 2016 , 2017 and 2018 with add rate of 7% then the modified wage would be

2015 = 246

2016 = 263.22

2017 = 281.65

2018 = 301.36 ...etc

if anyone could help i would be very grateful

10 REPLIES 10
Super User

Hi @Islam ,

Create the following measure:

``````Wage growth =
VAR MinimumYear =
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:

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog: Power BI em Português

Helper V

Here is the more explained post

Helper V

and also the add rate is not fixed i mean it's not always 7%

Helper V

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

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 Result =
SUM ( dtblBasicEmpInfo[Wage] ) * ( 1 + growthRate ) ^ ( currentyear - MinimumYear )
RETURN
Result``````

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog: Power BI em Português

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

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.

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog: Power BI em Português

Helper V

No problem sir I'll demonstrate a full example with manual answer so you can understand everything in details

Super User

appreciate

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog: Power BI em Português

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 ?

Announcements

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors