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
Anonymous
Not applicable

Previous months sales based on filter selection

Hi Experts

 

Based on my month and year filter selection I would like to calculate the previous month values and populate them into my results table.

So if I select Jan 2020, then return back the value for Dec 2019 and so on...

 

Cannot get the Previou Mth measure to work.

I have a Sales Fact Table and a Dim Date Table.

 

https://www.dropbox.com/s/2ztvkjq4nl0012d/sample%281%29.pbix?dl=0 

 

 

 

 

1 ACCEPTED SOLUTION

@Anonymous ,

 

I see you are refering the PY measure to the ACT measure. I've created a new measure:

_PY 2 = CALCULATE(SUM(FACT_SALES[Sales]),FACT_SALES[Scenario]="PY")

and edited the PY:

PY = CALCULATE([_PY 2], PREVIOUSMONTH('Calendar'[Date]))

 

and tested with a table visual, it worked.

 

I'm not familiar with this Zebra BI table, but with a table visual it worked.

 



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

Proud to be a Super User!



View solution in original post

3 REPLIES 3
camargos88
Community Champion
Community Champion

@Anonymous ,

 

I checked your file, it looks like you don't have values as Scenario = "ACT" for 2019.



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

Proud to be a Super User!



Anonymous
Not applicable

Thanks Camargos88.

 

One last question...select 2020 as a year i.have PY for 2019. They should populate. Unless you have spotted something else there too.

@Anonymous ,

 

I see you are refering the PY measure to the ACT measure. I've created a new measure:

_PY 2 = CALCULATE(SUM(FACT_SALES[Sales]),FACT_SALES[Scenario]="PY")

and edited the PY:

PY = CALCULATE([_PY 2], PREVIOUSMONTH('Calendar'[Date]))

 

and tested with a table visual, it worked.

 

I'm not familiar with this Zebra BI table, but with a table visual it worked.

 



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

Proud to be a Super User!



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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.