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
po
Post Prodigy
Post Prodigy

Previous weeks data

Hi,

 

We wish to get the last weeks of sales for previous week
 
Data in format
 
Customner Number, week ending date, %age sold
 
e.g 
 
10, 05/01/2019, 72%
10, 12/01/2019, 73%
10,19/01/2019, 75%
5, 12/01/2019, 90%
 
Wish to show  an additional column for each row wish the previous weeks percentage and then use this to capture upward or downward trend.
 
Some customers do not have all weeks and wish to ensure that all rows still show even if no previous sales.
 
was hoping belwo would work but somestimes when apply filter to e.g customer don;t see any rwos.
 
How can we best achieve this?
 
CALCULATE(SUM('Sales'[Sales %age]),FILTER(ALL('Sales'[Week Ending]),'Store Summary'[Week Ending]=MAX('Sales'[Week Ending])-7))
 
Thanks
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

You likely need to use EARLIER. And probably WEEKNUM as well. See my article on Mean Time Before Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...



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...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

You likely need to use EARLIER. And probably WEEKNUM as well. See my article on Mean Time Before Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...



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...

Thanks for reply.

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.