Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello,
Can you please assist with a DAX function to perform the following - Calculate the sum of sales by customer effective the promotion date (i..e all sales after 01-Mar-22). Note in some cases the promotion date may vary for different customers.
Solved! Go to Solution.
Hi @hassanh2 ,
You can create a measure.
Measure = CALCULATE(SUM('Sales Data'[Amount]),FILTER('Sales Data',[Date]>=MAX('Marketing Campaign'[Date])))
The output is in the lower right corner.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @hassanh2 ,
You can create a measure.
Measure = CALCULATE(SUM('Sales Data'[Amount]),FILTER('Sales Data',[Date]>=MAX('Marketing Campaign'[Date])))
The output is in the lower right corner.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you Stephen.
I was actually using the following code which worked at the customer level, but when I tried to summerise it in a visual to get for example by region - the "Total" is not correct - I guess the code just aggregate the sales by region from the MaxPromotion date (doesnt add the sales for each customer from the respective promotion date)
Thanks @rubayatyasmin , Im getting an error message that:
"The column Customer[PromotionDate] doesnt exist or doesnt have a relationship to any table available in the current context"
but there is already an active relationship between Customer ID in both tables "Sales[CustomerID]" and "Customers[CustomerID]" !!
@hassanh2 do you have a column in the same name as my DAX code? Like PromotionDate? If not then you need to use the correct table. Also, if the code doesn't work after the alteration use the below code.
Total Sales After Promotion :=
SUMX (
FILTER (
'Sales',
'Sales'[SaleDate] >= RELATED ( 'Promotions'[PromotionDate] )
),
'Sales'[SalesAmount]
)
Remember to replace the table and column names in the formula with the actual table and column names in your Power BI model.
Proud to be a Super User!
Hi, @hassanh2
Use this code:
Total Sales Post Promotion :=
CALCULATE(
SUM(Sales[SalesAmount]),
FILTER(
ALL(Sales),
Sales[SaleDate] > RELATED(Customers[PromotionDate])
)
)
Proud to be a Super User!
User | Count |
---|---|
64 | |
59 | |
47 | |
33 | |
32 |
User | Count |
---|---|
84 | |
75 | |
56 | |
50 | |
44 |