The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello!
I need to compare my sells last month and last year but only until the same time as now.
Ex: now is 02may22 10hA.M. -> I need to compare until 02apr22 until 10A.M. / 02may21 until 10A.M.
Any idea how can I do this?
PS: dateadd considers all the day, not until the same time
Solved! Go to Solution.
@gbernardes , Assuming you need from start of month
This month =
var _max = now()
var _min = eomonth(datevalue(_max) ,-1)+1
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[DateTime] >=_min && 'Table'[DateTime] <= _max) )
Last one Month Now =
var _maxDt = date(year(today()),Month(today())-1,day(Today()))
var _max = _maxDt+ timevalue(now())
var _min = eomonth(_maxDt,-1)+1
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[DateTime] >=_min && 'Table'[DateTime] <= _max) )
Last one Year SM Now =
var _maxDt = date(year(today())-1,Month(today()),day(Today()))
var _max = _maxDt+ timevalue(now())
var _min = eomonth(_maxDt,-1)+1
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[DateTime] >=_min && 'Table'[DateTime] <= _max) )
@gbernardes , Assuming you need from start of month
This month =
var _max = now()
var _min = eomonth(datevalue(_max) ,-1)+1
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[DateTime] >=_min && 'Table'[DateTime] <= _max) )
Last one Month Now =
var _maxDt = date(year(today()),Month(today())-1,day(Today()))
var _max = _maxDt+ timevalue(now())
var _min = eomonth(_maxDt,-1)+1
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[DateTime] >=_min && 'Table'[DateTime] <= _max) )
Last one Year SM Now =
var _maxDt = date(year(today())-1,Month(today()),day(Today()))
var _max = _maxDt+ timevalue(now())
var _min = eomonth(_maxDt,-1)+1
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[DateTime] >=_min && 'Table'[DateTime] <= _max) )
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
95 | |
94 | |
85 | |
69 | |
65 |
User | Count |
---|---|
240 | |
125 | |
122 | |
82 | |
80 |