Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi everyone,
I'm new to Power BI and DAX and would need a little help on a calculation that looks pretty basic...
I have a table that looks like this:
I want to create a column, in which I'll have the difference between the employee's salary and the average salary for this position (column [Position]). Then I could rapidly see if this employee has a salary below or above the average for this job.
Thank you for your help !
Solved! Go to Solution.
Hi, @ThomasKieny
for difference bw salary and average
try below column formula
for difference =
var a = AVERAGEX(FILTER('Table (3)','Table (3)'[position]=EARLIER('Table (3)'[position])),'Table (3)'[salary])
var b = ABS('Table (3)'[salary] - a)
return
b
for above and below
above and below =
var a = AVERAGEX(FILTER('Table (3)','Table (3)'[position]=EARLIER('Table (3)'[position])),'Table (3)'[salary])
RETURN
IF('Table (3)'[salary]<a,"below","above")
Hi,
Try these calculated column formulas
Average salary of position = calculate(average(Data[Salary]),filter(data,data[position]=earlier(data[position])))
Status = if(data[Salary]>data[Average salary of position],"Above",if(data[Salary]<data[Average salary of position],"Below","Same"))
Hope this helps.
Hi,
Try these calculated column formulas
Average salary of position = calculate(average(Data[Salary]),filter(data,data[position]=earlier(data[position])))
Status = if(data[Salary]>data[Average salary of position],"Above",if(data[Salary]<data[Average salary of position],"Below","Same"))
Hope this helps.
Hi, @ThomasKieny
for difference bw salary and average
try below column formula
for difference =
var a = AVERAGEX(FILTER('Table (3)','Table (3)'[position]=EARLIER('Table (3)'[position])),'Table (3)'[salary])
var b = ABS('Table (3)'[salary] - a)
return
b
for above and below
above and below =
var a = AVERAGEX(FILTER('Table (3)','Table (3)'[position]=EARLIER('Table (3)'[position])),'Table (3)'[salary])
RETURN
IF('Table (3)'[salary]<a,"below","above")
hi @ThomasKieny
if you want to add a column you can do this:
User | Count |
---|---|
106 | |
88 | |
81 | |
76 | |
73 |
User | Count |
---|---|
112 | |
103 | |
96 | |
74 | |
67 |