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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
evolve_Tricia
Helper I
Helper I

Problems occur then summarizing monthly totals of sales within 1 week by different promotions

Hello,

I'm trying to calculate sales after 1 week for different promotions and aggregate them by month and quarter. I had no problem making such measure for individual promotions.

DateDiscount namePromotionSales 1 week
2020/1/11DANCEpromotion12464.74
2020/1/15happyshoppingpromotion215811.39
2020/1/23happyshoppingpromotion318014.71
2020/2/8ninoshadespromotion420030.41
2020/2/10happyshoppingpromotion527346.81
2020/2/20happyshoppingpromotion654
2020/2/28daniilpromotion71172.63
2020/3/4happyshoppingpromotion822165.05
2020/3/7friendspromotion985.48

 

 

Sales 1 week = 
VAR date_online = MAX(promotion[Date])
VAR code =VALUES(promotion[Discount name])
RETURN
    CALCULATE(
      SUMX(FILTER(orders, orders[discount_name] IN code), orders[revenue]),
      DATESBETWEEN(orders[date],  date_online, date_online + 7))

 

 

 

evolve_Tricia_2-1600681453537.png

However, when aggretating by month, sales of the promotion at the end of February were calculated less than 1 week after promotion started because the time span has reached to another month. 

 

 

 

 

Sales 1 week sum = SUMX(VALUES(promotion[Date]), [Sales 1 week])
Sales 1 week by ym = SUMX(VALUES(date_table[year-mon]), [Sales 1 week sum])

 

 

 

 

evolve_Tricia_2-1600679482648.png


The total of 2020-02 should be 56321.25 rather than 38829.28.

When I selected 2020-02, obviously sales of promotion4 within a week were calculated only till the end of February for only 2538.44. Is it possible to adjust the DAX of this measure to cover the complete 1 week sale not affected by months? 

evolve_Tricia_0-1600681319039.png

 

Thanks.

 

 

3 REPLIES 3
amitchandak
Super User
Super User

@evolve_Tricia ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

I have provided a sample data in the begining of my original post. 

Hi @evolve_Tricia ,

 

I don't know what is the relationships between your tables , and which fields are used in your visual. What you need to know is that the value of the measure is relevant to the current context.

Try to add filter condition to these measure "Sales 1 week by ym" ,"Sales 1 week sum".

If the problem persists,could you share the sample pbix via cloud service like onedrive for business?

Please mask any sensitive data before uploading

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.