Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
example: If the user selects "Past months" slicer the visual should show only latest month data on the visulas.
Let's say in the " Past Month" slicer if it's a month like from jan 2021 to Dec 2022 , the dax has to show only for max month values which is Dec 22 .
@sumanchintala19 , You can try like
https://medium.com/chandakamit/power-bi-when-i-felt-lazy-and-i-needed-too-many-measures-ed8de20d9f79
refer
Switch Period =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min =
SWITCH(SELECTEDVALUE(Period[PeriodType],"MTD"),
"YTD",eomonth(_max,-1*MONTH(_max))+1 , //FY April -March
"FYTD",if( Month(_max) <4 , date(year(_max)-1,4,1) ,date(year(_max),4,1)), //FY April -March
"QTD",eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1,
"MTD",eomonth(_max,-1)+1 ,
"WTD", _max -WEEKDAY(_max,2)+1,
"Cumm", Minx(ALLSELECTED('Date'),'Date'[Date]),
"Rolling 3", date(Year(_max), month(_max) -3, Day(_max))+1,
"Rolling 6", date(Year(_max), month(_max) -6, Day(_max))+1,
"Rolling 12", date(Year(_max), month(_max) -12, Day(_max))+1,
BLANK())
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
or
Switch Period =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max =
SWITCH(SELECTEDVALUE(Period[PeriodType],"MTD"),
"YTD",_max1,
"FYTD",_max1,
"QTD",_max1,
"MTD",_max1,
"This Month",eomonth(_max,0),
"LMTD",date(Year(_max), month(_max) -1, Day(_max)),
"Last Month",eomonth(_max,-1),
"WTD", _max1,
"Cumm",_max1,
"Rolling 3", _max1,
"Rolling 6", _max1,
"Rolling 12",_max1,
"Rolling 7 Day",_max1,
"Yesterday",_max1-1,
BLANK())
var _min =
SWITCH(SELECTEDVALUE(Period[PeriodType],"MTD"),
"YTD",eomonth(_max,-1*MONTH(_max))+1 , //FY April -March
"FYTD",if( Month(_max) <4 , date(year(_max)-1,4,1) ,date(year(_max),4,1)), //FY April -March
"QTD",eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1,
"MTD",eomonth(_max,-1)+1 ,
"This Month",eomonth(_max,-1)+1 ,
"LMTD",eomonth(_max,-1)+1,
"Last Month",eomonth(_max,-1)+1,
"WTD", _max -WEEKDAY(_max,2)+1,
"Cumm", Minx(ALLSELECTED('Date'),'Date'[Date]),
"Rolling 3", date(Year(_max), month(_max) -3, Day(_max))+1,
"Rolling 6", date(Year(_max), month(_max) -6, Day(_max))+1,
"Rolling 12", date(Year(_max), month(_max) -12, Day(_max))+1,
"Rolling 7 Day", date(Year(_max), month(_max) , Day(_max)-7),
"Yesterday",_max1-1
BLANK())
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
41 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
32 | |
30 | |
18 | |
18 |