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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
fcastle
Helper I
Helper I

excluding new employees from salary averages

Hi, been a long time since posting here, but here goes;

 

I have three tables:

Transactions:

fcastle_0-1629119219670.png

Employee:

fcastle_1-1629119230711.png

and Date (standard date table), with these relationships:

fcastle_2-1629119303703.png

 

I have one measure:


Salary increase per year =
VAR thisyear =
    CALCULATE ( SUM ( transactions[Amount] ) )
VAR lastyear =
    CALCULATE ( SUM ( transactions[Amount] )SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
VAR rawcalc = ( thisyear - lastyear ) / lastyear
RETURN
    IFERROR ( rawcalcBLANK () )

 

 

fcastle_4-1629119778498.png

 

I think I need to filter "this" years totals based on the individuals having a sum in the previous year, but every variant i try seems to be a dead end.

 

Any insights are much appreciated!

 

1 ACCEPTED SOLUTION
fcastle
Helper I
Helper I

Thanks for your assistrance @Greg_Deckler 

I sorted it out when reading this.
https://p3adaptive.com/2015/08/nested-sumx-or-dax-query/

 

fcastle_0-1629201253201.png

 

View solution in original post

7 REPLIES 7
fcastle
Helper I
Helper I

Thanks for your assistrance @Greg_Deckler 

I sorted it out when reading this.
https://p3adaptive.com/2015/08/nested-sumx-or-dax-query/

 

fcastle_0-1629201253201.png

 

Greg_Deckler
Community Champion
Community Champion

@fcastle Try:

Salary increase per year =
VAR thisyear =
    CALCULATE ( SUM ( transactions[Amount] ) )
VAR lastyear =
    CALCULATE ( SUM ( transactions[Amount] ), SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
VAR rawcalc = ( thisyear - lastyear ) / lastyear
RETURN
    IF(ISBLANK(lastyear),BLANK(),IFERROR ( rawcalc, BLANK () ))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

 

Thanks but issue persists. I think the key is to find a way to pass a list of dimensions (employeeid) to a sum measure.

@fcastle Perhaps:

Salary increase per year =
VAR __Table = SUMMARIZE('transactions',[employeeid],"increase",
VAR thisyear =
    CALCULATE ( SUM ( transactions[Amount] ) )
VAR lastyear =
    CALCULATE ( SUM ( transactions[Amount] ), SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
VAR rawcalc = ( thisyear - lastyear ) / lastyear
RETURN
    IF(ISBLANK(lastyear),BLANK(),IFERROR ( rawcalc, BLANK () )))
RETURN
  SUMX(__Table,[increase])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

no cigar unfortunately 🙂

fcastle_0-1629128691605.png

 

@fcastle Paste the sample data as text or provide a link to the sample PBIX table so I can recreate.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

first; thank you very much for helping out a mate, greatly appreciated!

 

fcastle_0-1629138281273.png

 

link to sample file:
https://1drv.ms/u/s!AtjU9aGZ2mSSgRqKvKE8ZC7ZLQZB?e=XTnfo9 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.