Forum Discussion

ADSL's avatar
ADSL
Icon for Post Prodigy rankPost Prodigy
4 years ago
Solved

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,  
  • parry2k's avatar
    4 years ago

    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.