Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi All,
iam trying to get 2 calander week back (not 14 days)
this is my measure
SalesTwoWeeksAgo =
CALCULATE (
SUM ( 'Table'[SalesAmount] ),
FILTER (
ALL ( 'Table' ),
COUNTROWS (
FILTER (
'Table',
EARLIER ( 'Table'[Date] ) = DATEADD ( 'Table'[Date], -14, DAY )
)
)
)
)
Solved! Go to Solution.
Hi @netanel ,
You can modify the DAX formula to the following:
Measure =
var _week=WEEKNUM(MAX('Table'[Date]),2)
var _lastweek=WEEKNUM(MAX('Table'[Date]),2)-1
var _nextweek=WEEKNUM(MAX('Table'[Date]),2)+1
var _mindate=
MINX(
FILTER(ALL('Table'),WEEKNUM('Table'[Date],2) = _lastweek),'Table'[Date])
var _maxdate=
MAXX(
FILTER(ALL('Table'),WEEKNUM('Table'[Date],2) = _nextweek),'Table'[Date])
return
CALCULATE (
SUM ( 'Table'[SalesAmount] ),
FILTER (
ALL ( 'Table' ),
COUNTROWS (
FILTER (
'Table',
'Table'[Date]>=_mindate&&'Table'[Date]<=_maxdate
)
)
)
)
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @netanel ,
You can modify the DAX formula to the following:
Measure =
var _week=WEEKNUM(MAX('Table'[Date]),2)
var _lastweek=WEEKNUM(MAX('Table'[Date]),2)-1
var _nextweek=WEEKNUM(MAX('Table'[Date]),2)+1
var _mindate=
MINX(
FILTER(ALL('Table'),WEEKNUM('Table'[Date],2) = _lastweek),'Table'[Date])
var _maxdate=
MAXX(
FILTER(ALL('Table'),WEEKNUM('Table'[Date],2) = _nextweek),'Table'[Date])
return
CALCULATE (
SUM ( 'Table'[SalesAmount] ),
FILTER (
ALL ( 'Table' ),
COUNTROWS (
FILTER (
'Table',
'Table'[Date]>=_mindate&&'Table'[Date]<=_maxdate
)
)
)
)
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
80 | |
77 | |
63 | |
48 | |
44 |
User | Count |
---|---|
102 | |
44 | |
39 | |
39 | |
36 |