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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
powerbi_jenhen
Resolver II
Resolver II

Calculate Previous Month Values

Hi,

 

I have the below FACT table:

powerbi_jenhen_0-1688118075482.png

I'm looking to show the previous month "AMOUNT" values based on the unique "ContractEntityKey" values (this has a relationship to a DIM table), i.e. show the January values within the February rows. Each month shares the same row count of keys (so the same DIM details), I just need need to perform a row calculation to produce a variance value. I've used the PreviousMonth function but I get blanks.

 

Any help appreciated.

 

Thanks.

1 ACCEPTED SOLUTION
powerbi_jenhen
Resolver II
Resolver II

I actually had a bad DIM table, once I added the correct unique DIM key to the FACT table and added a Dates table the below Calculated Columns worked:

 

Date PM Col = DATEADD(Dates[Date],-1,MONTH)
 
PM Amount = CALCULATE(MAX(Fact[AMOUNT]),FILTER(ALL(Fact),Fact[DimContractEntityKey]=EARLIER(Fact[DimContractEntityKey])&&Fact[Date]=EARLIER(Fact[Date PM Col])))

View solution in original post

1 REPLY 1
powerbi_jenhen
Resolver II
Resolver II

I actually had a bad DIM table, once I added the correct unique DIM key to the FACT table and added a Dates table the below Calculated Columns worked:

 

Date PM Col = DATEADD(Dates[Date],-1,MONTH)
 
PM Amount = CALCULATE(MAX(Fact[AMOUNT]),FILTER(ALL(Fact),Fact[DimContractEntityKey]=EARLIER(Fact[DimContractEntityKey])&&Fact[Date]=EARLIER(Fact[Date PM Col])))

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors