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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Islam
Helper V
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 

differenceregular add dateassign date
001/07/201501/08/2014
101/07/2016 
101/07/2017 
001/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

 

https://drive.google.com/file/d/1xxsgJyZs3ljDQP4vDjrVK9exOHlF-1F9/view?usp=sharing 

10 REPLIES 10
MFelix
Super User
Super User

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:

 

MFelix_0-1614690070974.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Here is the more explained post 

@v-kkf-msft 

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

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 

Assigning Date.png

 

then the difference between assigning date will be a year if compared to DecImpDate Like following picture 

 

 

Regular Add Date.png

so the resulted regular add in 1/7/2015 should be 246*1.05 not just 246 like following picture

 

Result.png

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

 

 

 

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

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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

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


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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

appreciate


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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 ?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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