The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hiya,
I am making some KPI cards, and am wishing to link the target values to the relative date slicer. (weeks, months, etc)
For example, when I choose "Last 2 months", I would like to get a "Previous Month" target.
When I choose "Last 2 weeks", I would like to get a "Previous Week" target.
I could not figure out how to 'extract' that input as some sort of unit to put in a measure.
Help would be much appreciated!
Solved! Go to Solution.
@Anonymous , Try measure like
Last month =
var _max1 = if(isfiltered('Date'),Min( 'Date'[Date]) , today())
var _max = eomonth(_max1,-1)
var _min = eomonth(_max1,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
Last week =
var _max1 = if(isfiltered('Date'),Min( 'Date'[Date]) , today()) -7
var _max = _max1 - weekday(_max,2)+7
var _min = _max1 - weekday(_max,2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
@Anonymous , Try measure like
Last month =
var _max1 = if(isfiltered('Date'),Min( 'Date'[Date]) , today())
var _max = eomonth(_max1,-1)
var _min = eomonth(_max1,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
Last week =
var _max1 = if(isfiltered('Date'),Min( 'Date'[Date]) , today()) -7
var _max = _max1 - weekday(_max,2)+7
var _min = _max1 - weekday(_max,2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
User | Count |
---|---|
15 | |
13 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
19 | |
13 | |
9 | |
5 |