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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Tihannah
Resolver II
Resolver II

Prior Week Calculation with Segments

My Prior Week Calculation is working fine... until I bring segments in.

 

This is my dax:

Prior Wk Sales = CALCULATE(SUM(Table[Sales]),FILTER(ALL(Date Table),Date Table[WeekRank]=MAX(Date Table[WeekRank])-1))
 
In this table, I have both a Week Rank and Week Number column:
WeekRank = RANKX(ALL(Date Table),Date Table[WkStartDate],,ASC,Dense)
WeekNum = WEEKNUM('Date Table'[WkStartDate])
WkStartDate = Date Table[Business_Date] - WEEKDAY('Date Table'[Business_Date],2)+1
WkEndDate = Date Table[Business_Date] -WEEKDAY(Date Table[Business_Date],2)+7
 
I have 3 business segments I'm looking. And they have their own dimension table. I'll call them:
Books
Shoes
Candles
 
If I'm just looking at a roll up, prior week calc works fine. But when I bring in the segments, the rollup just duplicates under each segment. What am I missing?? 
 
 
1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Tihannah,

 

I've tried recreating your use case usnig my dummy data and it seems that your segment table doesn't have a relationship with your fact/sales table. You can see in the screenshot below that prior week is split into segments

 

danextian_0-1685789137527.png

Without the relationship, you'll see equal amounts for each segment by week.

danextian_1-1685789206170.png

Please see attached pbix for your reference. 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

2 REPLIES 2
danextian
Super User
Super User

Hi @Tihannah,

 

I've tried recreating your use case usnig my dummy data and it seems that your segment table doesn't have a relationship with your fact/sales table. You can see in the screenshot below that prior week is split into segments

 

danextian_0-1685789137527.png

Without the relationship, you'll see equal amounts for each segment by week.

danextian_1-1685789206170.png

Please see attached pbix for your reference. 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

My segment table did have a relationship to the fact table, but the attached file helped me figure out where I was going wrong with the week columns and my dax, so thank you!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Users online (12,764)