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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
vk_18
Regular Visitor

Lift of sales based on promo activity

Hi All

I want to calculate lift of sales bsaed on promo activity. Activities are on week basis

 

i have the data at an order level as follows

 

SKUidActivityDate(Week)Sales

10

A22-02-2022150
20A22-02-2022100
15B

15-10-

2022

40
10no2-08-20225
25B15-10-202215
20no2-08-202250
25no15-01-202210
10no6-05-202215

 

Now i need to calculate lift of activity(avg sales per week) when skus are in that activity from when they are not in activity

Activityavg sales per week of activityavg sales per week not activityliftlift %
A100+1505+50+15(100+150)-(5+50+15)(180)/(5+50+15)
B40+151040+15- (10)(45)/(25)

 

So lift of activity is basically calculated as average sales per week os skus for that activity and subtracting avg sales per week of those  skus only when not in activity

Can you help me with the DAX for the same
i was able to calculate DAX for avg sales per week of activity
But am unable to calculate avg sales per week when not in activity

 

Thanks

2 REPLIES 2
lbendlin
Super User
Super User

Your expected result doesn't match your sample data. For SKU 25 the non-activity value should be 10, not 25.

Sahir_Maharaj
Super User
Super User

Hello @vk_18,

 

Can you please try this:

AverageSalesNotInActivity =
VAR SkusInActivity =
    CALCULATETABLE(
        VALUES('Table'[SKUid]),
        'Table'[Activity] = EARLIER('Table'[Activity])
    )
VAR SkusNotInActivity =
    EXCEPT(VALUES('Table'[SKUid]), SkusInActivity)
RETURN
    AVERAGEX(
        SUMMARIZE('Table', 'Table'[Date(Week)], "TotalSales", SUM('Table'[Sales])),
        IF(COUNTROWS(INTERSECT(SkusNotInActivity, SkusInActivity)) = 0, [TotalSales], BLANK())
    )

Should you need further assistance please don't hesitate to reach out to me.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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