Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hi,
I have calculated the sales after unique permotions with certain discount_name (discounts can be repeatedly used). Here is the DAX for calculating sales within 48 hours after each promotion which summarized the revenue from "orders" table.
Sales 48h =
VAR date_online = MAX(performance[Date])
RETURN
CALCULATE(
SUM(orders[revenue]),
DATESBETWEEN(orders[date], date_online, date_online + 2)
)
Here is the table "performance"
However, when I sum "sales 48 hours" , the total was wrong. Obviously it has taken the max dates of that month/quarter for calculating sums. For example, the total "sales 48h" for 2020-01 should be (982.38+9484.75+5951.44)=16418.57 not 32,303.20. But I tried modifying the DAX, none of them work 😑. Probably a separate measure calculated on a monthly basis is needed?
Any input is appreciated.
Solved! Go to Solution.
have you tried
measure= sumx(value('performance'[date], Sales 48h)
Proud to be a Super User!
have you tried
measure= sumx(value('performance'[date], Sales 48h)
Proud to be a Super User!
@ryan_mayu
Thank you for your response. I followed your logic and corrected my DAX as
SUMX(VALUES(performance[Date]), performance[Sales 48h]))And it worked like a charm!!!! Thanks!
You are welcome.
Proud to be a Super User!
@evolve_Tricia , try like
Sales 48h =
VAR date_online = MAX(performance[Date])
RETURN
sumx(summarize( orders,orders[date],orders[promotion] ,"_1"
CALCULATE(
SUM(orders[revenue]),
DATESBETWEEN(orders[date], date_online, date_online + 2)
)),[_1])
Sales 48h =
VAR date_online = MAX(performance[Date])
RETURN
sumx(values( orders[date])
CALCULATE(
SUM(orders[revenue]),
DATESBETWEEN(orders[date], date_online, date_online + 2)
))
@evolve_Tricia , Try like
Sales 48h =
VAR date_online = MAX(performance[Date])
RETURN
CALCULATE(
SUM(orders[revenue]),values(orders[date]), values(orders[promotion]),
DATESBETWEEN(orders[date], date_online, date_online + 2)
)
Sales 48h =
VAR date_online = MAX(performance[Date])
RETURN
sumx( orders,orders[date],orders[promotion] ,"_1"
CALCULATE(
SUM(orders[revenue]),
DATESBETWEEN(orders[date], date_online, date_online + 2)
),[_1])
@amitchandak
Thanks for your prompt respons.
I got the same result from your first DAX. The second one didn't work because orders does not contains "promotion" column. But even if I use performance[promotions], the numbers were not the total of sales 48hr either
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 56 | |
| 42 | |
| 40 | |
| 21 | |
| 21 |
| User | Count |
|---|---|
| 149 | |
| 105 | |
| 63 | |
| 36 | |
| 36 |