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 August 31st. Request your voucher.
HI,
I'm totally new to power BI.
I'm trying to filter date range of the line chart using a tree map filter as "In the last 1 month, 2 months, 3 months, 6 months, 1 year, and 2 years". That is if I click on 1 month the line grapgh should show last 1 month data from today.
but It does not change when clicking 1month. Can you all please help.
Solved! Go to Solution.
@Anonymous , In this case, your date range needs to be bigger than the selected period else you need independent date slicer
var _max = if(SELECTEDVALUE(Period[PeriodType],"MTD") = "Yesterday",MAX( 'Date'[Date])-1 , today()-1)
var _min =
SWITCH(SELECTEDVALUE(Period[PeriodType],"MTD"), //selected by tree map
"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,Month(_max)))+1,
"MTD",eomonth(_max,-1)+1 ,
"2 Month", date(Year(_max), month(_max) -3, Day(_max))+1,
"3 Month", date(Year(_max), month(_max) -3, Day(_max))+1,
"6 Month", date(Year(_max), month(_max) -6, Day(_max))+1,
"12 Month", date(Year(_max), month(_max) -12, Day(_max))+1,
BLANK())
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))
In case you select a range small then what you want
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
Hi @Anonymous,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
@Anonymous , In this case, your date range needs to be bigger than the selected period else you need independent date slicer
var _max = if(SELECTEDVALUE(Period[PeriodType],"MTD") = "Yesterday",MAX( 'Date'[Date])-1 , today()-1)
var _min =
SWITCH(SELECTEDVALUE(Period[PeriodType],"MTD"), //selected by tree map
"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,Month(_max)))+1,
"MTD",eomonth(_max,-1)+1 ,
"2 Month", date(Year(_max), month(_max) -3, Day(_max))+1,
"3 Month", date(Year(_max), month(_max) -3, Day(_max))+1,
"6 Month", date(Year(_max), month(_max) -6, Day(_max))+1,
"12 Month", date(Year(_max), month(_max) -12, Day(_max))+1,
BLANK())
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))
In case you select a range small then what you want
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI