Forum Discussion
How to Calculate Total Sales for Specific Date
Hi BI Team,
As per business need we want to calculate the Total Sales from day 01 till day 25th of the month.
Could you please kindly advise the measure of this request.
Best Regards,
ADSL the relationship between date table and order table is on the month column which is always showing the 1st day of the month, first you need to change that relationship and also update the measure as shown below
Total Sales Day 01 - 25 = SUMX ( VALUES ( 'Date'[MonthnYear] ), VAR __date = CALCULATE ( MAX ( 'Date'[Date] ) ) VAR __startDate = EOMONTH ( __date, -1 ) + 1 VAR __endDate = DATE ( YEAR ( __date ), MONTH ( __date ), 25 ) RETURN CALCULATE ( SUM('Order'[Amount No VAT]), DATESBETWEEN ( 'Date'[Date], __startDate, __endDate ) ) )✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
5 Replies
- parry2k
Super User
ADSL the relationship between date table and order table is on the month column which is always showing the 1st day of the month, first you need to change that relationship and also update the measure as shown below
Total Sales Day 01 - 25 = SUMX ( VALUES ( 'Date'[MonthnYear] ), VAR __date = CALCULATE ( MAX ( 'Date'[Date] ) ) VAR __startDate = EOMONTH ( __date, -1 ) + 1 VAR __endDate = DATE ( YEAR ( __date ), MONTH ( __date ), 25 ) RETURN CALCULATE ( SUM('Order'[Amount No VAT]), DATESBETWEEN ( 'Date'[Date], __startDate, __endDate ) ) )✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
- parry2k
Super User
ADSL you can try something like this
Total Sales = VAR __date = MAX ( 'Calendar'[Date] ) VAR __startDate = EOMONTH ( __date, -1 ) + 1 VAR __endDate = DATE ( YEAR ( __date ), MONTH ( __date ), 25 ) RETURN CALCULATE ( SUM ( Table[Sales] ), DATESBETWEEN ( 'Calendar'[Date], __startDate, __endDate ) )✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
- ADSL
Post Prodigy
Hi parry2k,
Thank you for your feedback.
But after trying your measure, it seem not working. Please kindly assist to check the screenshot or access to file that I create - https://drive.google.com/file/d/1qi5o6KhV9KpqSQP07dr6xfFJlGnzcfPH/view?usp=sharing
- parry2k
Super User
ADSL 👏
✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.