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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.