Forum Discussion
ricardo_cvo
Helper I
8 years agoDax Sales by Period
Good afternoon everyone, I am new to dax and need to get the sum of sales as follows: Sales from day 1 to day 30 Sales from the 31st to the 60th It's possible? Thank you
v-huizhn-msft
Microsoft Employee
8 years agoHi ricardo_cvo,
Yes, you can use the DATESINPERIOD function to calculate the sum sales in a period. You can change the interval parameter, the following first formula calculates the total sum from last 31 days until the last date of your date, the second one calculates the total sum from last 60 days until the last date of your date.
Last 31 Days =
CALCULATE (
SUM ( Table[Total] ),
DATESINPERIOD ( Table[Date], LASTDATE ( Table[Date] ), -31, DAY )
)
Last 60 Days =
CALCULATE (
SUM ( Table[Total] ),
DATESINPERIOD ( Table[Date], LASTDATE ( Table[Date] ), -60, DAY )
)
Best Regards,
Angelia
ricardo_cvo
Helper I
8 years agoThanks for the answer
I did the calculation however is coming a value much higher for the calculation of 60 days what could be?
Regards