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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
spartan27244
Resolver I
Resolver I

Calculate a previous period Sum

As in the example on this page SAMEPERIODLASTYEAR function (DAX) - DAX | Microsoft Docs

= CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), SAMEPERIODLASTYEAR(DateTime[DateKey]))

 

I too am trying to do the same, my measuer formula is as so

PrevPrdPlanPaid = CALCULATE(Sum(MedClaims[PlanPaid]), SAMEPERIODLASTYEAR(Dates[Date]))
However my visual always shows a blank, when it should show for example in 2019-FY 10,503,949.37 i.e. the 2018-FY value, etc. I know this seems point less but the number will be used to calculate a rate of change which is simple math once I can get the number. I have attached PBX file, well apparently I cannot attach a file so here is the onedrive link
 
 
spartan27244_0-1623952589188.png

My data model is very simple, note the Date table is Marked as a Date Table.

 

spartan27244_1-1623952658935.png

 

 

 

3 REPLIES 3
CNENFRNL
Community Champion
Community Champion

For most seansoned DAX users, both cross filtering direction (bi-directions) in data model is time bomb rather than cure-all. At least for me, I rely on mono-directional relations in data model.

Screenshot 2021-06-17 222112.png

Screenshot 2021-06-17 222143.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Looks like this works

 

PrevPlanPaid =
Var D = DATESBETWEEN(Dates[Date], DateAdd(firstdate(Dates[Date]), -1, year), DATEADD(LASTDATE(Dates[Date]), -1, YEAR))

return CALCULATE(Sum(MedClaims[PlanPaid]), REMOVEFILTERS(ReportPeriods), D)

By removing the bidirectional filter, none of the other visuals are calculated properly

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.