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
jrickerts
New Member

Filter by Slicer Selection

Good day

 

I want to see how effective a promotion was by comparing rate of sale per day off promotion before a promotion started and compare it with the rate of sale per day during the promotion. So if a product sold 10 units a day off promotion 7 days before I put that product on promotion, I am hoping to see that I see more than 10 units a day during the promotion. 

 

I cannot seem to isolate the products that are on a particular promotion. 

Screenshot 2023-02-01 142820.png

 

In the above screenshot, I selected two promotion, called December 2022 Month End Promotion and Hyper Weekend Promotion. Firstly, I must be able to determine what the MIN Start Date of the two promotion are. In this example, I hard coded the date. The minimum start date for the two selected promotions is 15 December 2022. Then I want to see how many products were sold 7 days before the 15th of December 2022. In the table, it returns all 5 Products in the product table. I cancelled out product 4, because that product wasn't sold on either of the selected promotions. 

There is also no result (blank) for product 2. I want this result to be zero. And finally the total should be correct at the bottom. It doesn't show a result but I'd like it to be 409. 

 

I tried to create a new table showing the promotional products, but I have had little success in filtering the table to only show the products that are on the selected promotions. 

 

Here is my model. 

 

Screenshot 2023-02-01 153331.jpg

 

Here is my DAX measure. 

Off Promo Qty Sold Pre-Promo =
VAR selectedproduct = SELECTEDVALUE(Products[ProductID])
VAR maxdate = CONVERT("2022-12-15", DATETIME)
VAR mindate = maxdate - 7
RETURN
CALCULATE(SUM(Sales[Qty Sold]), ALL(Sales), Sales[PromotionID] = BLANK(), 'Sales'[Date] < maxdate, Sales[Date] >= mindate, 'Products'[ProductID] = selectedproduct)

 

 

Can anyone assist? 

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

Hi @jrickerts,

You can try to use the following measure formula if it suitable for your requirement:

Off Promo Qty Sold Pre-Promo =
VAR selectedproduct =
    VALUES ( Products[ProductID] )
VAR currPromotion =
    VALUES ( Promotion[PromotionID] )
RETURN
    CALCULATE (
        SUM ( Sales[Qty Sold] ),
        FILTER (
            ALL ( Sales ),
            'Sales'[ProductID]
                IN selectedproduct
                    && COUNTROWS (
                        FILTER (
                            ALLSELECTED ( Promotion ),
                            [PromotionID]
                                IN currPromotion
                                && 'Sales'[Date] < Promotion[EndDate]
                                && Sales[Date] >= Promotion[StartDate]
                        )
                    ) > 0
        )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-shex-msft
Community Support
Community Support

Hi @jrickerts,

You can try to use the following measure formula if it suitable for your requirement:

Off Promo Qty Sold Pre-Promo =
VAR selectedproduct =
    VALUES ( Products[ProductID] )
VAR currPromotion =
    VALUES ( Promotion[PromotionID] )
RETURN
    CALCULATE (
        SUM ( Sales[Qty Sold] ),
        FILTER (
            ALL ( Sales ),
            'Sales'[ProductID]
                IN selectedproduct
                    && COUNTROWS (
                        FILTER (
                            ALLSELECTED ( Promotion ),
                            [PromotionID]
                                IN currPromotion
                                && 'Sales'[Date] < Promotion[EndDate]
                                && Sales[Date] >= Promotion[StartDate]
                        )
                    ) > 0
        )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.