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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
ccc123
New Member

context and calculation

I have 2 sales files Aw and Aw-1, with 1 week of difference. I want to measure the evolution. In a visual matrice in the data report, I used a hierarchy coming from Aw. When I want to catch up the Sales of previous week (file Aw-1, which is built identical as Aw), for each row I have the total of sales previous week and not the detail
How can I have the sales of previous week ?

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @ccc123 ,

 

I create the following relationship.

 

vkkfmsft_0-1645434046734.png

 

Then create these measures:

 

W = CALCULATE ( SUM ( Aw[Sales] ), USERELATIONSHIP ( Aw[Date], Dates[Date] ) )
W-1 = 
CALCULATE (
    SUM ( 'Aw-1'[Sales] ),
    FILTER (
        'Aw-1',
        'Aw-1'[Product] = MAX ( Aw[Product] )
            && 'Aw-1'[Sub_Product] = MAX ( Aw[Sub_Product] )
    ),
    USERELATIONSHIP ( Dates[Date], 'Aw-1'[Date] )
)
Measure = IF ( [W] = BLANK (), [W-1], [W] )

vkkfmsft_1-1645434184406.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @ccc123 ,

 

I create the following relationship.

 

vkkfmsft_0-1645434046734.png

 

Then create these measures:

 

W = CALCULATE ( SUM ( Aw[Sales] ), USERELATIONSHIP ( Aw[Date], Dates[Date] ) )
W-1 = 
CALCULATE (
    SUM ( 'Aw-1'[Sales] ),
    FILTER (
        'Aw-1',
        'Aw-1'[Product] = MAX ( Aw[Product] )
            && 'Aw-1'[Sub_Product] = MAX ( Aw[Sub_Product] )
    ),
    USERELATIONSHIP ( Dates[Date], 'Aw-1'[Date] )
)
Measure = IF ( [W] = BLANK (), [W-1], [W] )

vkkfmsft_1-1645434184406.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@ccc123 , Please refer if my blogs can help on that

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8

 

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.