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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Super User
Super User

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


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

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


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for reply.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.