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
NAMI1356
Frequent Visitor

Create Last Week Sales Data from Accumulation of Raw Data

 

Hi,

 

How to calculate weekly sales from Cumulative Data source - 

 

Scenario: We have 10,000 products and each week they might be some sales for them , so when we pull report for Week 1 , the Data shows actual sales for Week 1 ( Week 1 January 2017) , 

 

when we pull report by week 2 , it shows the Accumulated Sales Value. (Date format shows as i.e. 8 January 2017) 

 

 

How in Power Bi we get weekly sales ( technically "Week2 Sales - Week 1 Sales"   ) to calculate Week on Week (WoW) Growth?

 

 

 

-----------------------------

 

 

Customer ID Category Value Date
4 DESKTOP 144 1-Nov
4 PRINTER 109 1-Nov
1 TONER 122 1-Nov
7 LAPTOP 166 1-Nov
2 TONER 149 1-Nov
8 LAPTOP 141 1-Nov
9 TONER 172 1-Nov
8 LAPTOP 123 1-Nov
9 TONER 182 1-Nov
8 DESKTOP 158 1-Nov
3 DESKTOP 185 1-Nov
2 DESKTOP 159 1-Nov
9 DESKTOP 151 1-Nov
1 DESKTOP 196 1-Nov
5 DESKTOP 171 1-Nov
4 DESKTOP 300 8-Nov
8 DESKTOP 350 8-Nov
7 DESKTOP 400 8-Nov
8 DESKTOP 450 8-Nov
4 DESKTOP 100 8-Nov
5 DESKTOP 200 8-Nov
4 DESKTOP 240 8-Nov
5 DESKTOP 345 8-Nov
4 LAPTOP 654 8-Nov
9 LAPTOP 234 8-Nov
5 LAPTOP 432 8-Nov

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@NAMI1356

 

I assume you need to analyze on Product Level as well. So you can create measure like below: 

 

Weekly Growth=
CALCULATE (
    SUM ( Table[Sales] ),
    FILTER (
        ALL ( Table ),
        Table[Category] = MAX ( Table[Category] )
            && Table[Date]
                = MAX ( Table[Date] ) - 7
    )
)

Regards,

View solution in original post

2 REPLIES 2
v-sihou-msft
Employee
Employee

@NAMI1356

 

I assume you need to analyze on Product Level as well. So you can create measure like below: 

 

Weekly Growth=
CALCULATE (
    SUM ( Table[Sales] ),
    FILTER (
        ALL ( Table ),
        Table[Category] = MAX ( Table[Category] )
            && Table[Date]
                = MAX ( Table[Date] ) - 7
    )
)

Regards,

@v-sihou-msft

 

Hi Simon,

 

Let I try the DAX and will let know the outcome

 

Thanks for your solution and time.

 

Nami

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.