Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I was wondering if anyone knew of a measure that I could use to calculate the total on the last day of the previous week and the week before (last day of the week ideally should be a saturday).
Solved! Go to Solution.
Hi @Shenee ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create two measures as below:
Previous 1 week =
VAR _seldate =
SELECTEDVALUE ( 'Table'[Date] )
RETURN
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table'),
'Table'[Date] < _seldate
&& WEEKNUM ( 'Table'[Date], 1 )
= WEEKNUM ( _seldate, 1 ) - 1
&& WEEKDAY ( 'Table'[Date], 2 ) = 6
)
)
Previous 2 week =
VAR _seldate =
SELECTEDVALUE ( 'Table'[Date] )
RETURN
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Date] < _seldate
&& WEEKNUM ( 'Table'[Date], 1 )
= WEEKNUM ( _seldate, 1 ) - 2
&& WEEKDAY ( 'Table'[Date], 2 ) = 6
)
)
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi @Shenee ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create two measures as below:
Previous 1 week =
VAR _seldate =
SELECTEDVALUE ( 'Table'[Date] )
RETURN
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table'),
'Table'[Date] < _seldate
&& WEEKNUM ( 'Table'[Date], 1 )
= WEEKNUM ( _seldate, 1 ) - 1
&& WEEKDAY ( 'Table'[Date], 2 ) = 6
)
)
Previous 2 week =
VAR _seldate =
SELECTEDVALUE ( 'Table'[Date] )
RETURN
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Date] < _seldate
&& WEEKNUM ( 'Table'[Date], 1 )
= WEEKNUM ( _seldate, 1 ) - 2
&& WEEKDAY ( 'Table'[Date], 2 ) = 6
)
)
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
@Shenee , Try measure like
Last Week Last day =
var _min = today() -WEEKDAY(today() ,2) -6 //Monday week start
var _max = _min +6
return CALCULATE([Net], FILTER('Date','Date'[Date] = _max))
last 2 last week
2nd Last Week Last day =
var _min = today() -WEEKDAY(today() ,2) -6 //Monday week start
var _max = _min +6 -7
return CALCULATE([Net], FILTER('Date','Date'[Date] = _max))
both together
Last day for last 2 weeks =
var _min = today() -WEEKDAY(today() ,2) -6 //Monday week start
var _max = _min +6
var _max1 = _min +6 -7
return CALCULATE([Net], FILTER('Date','Date'[Date] = _max || 'Date'[Date] = _max1))
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
120 | |
101 | |
71 | |
61 |