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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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