Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
IndrachapaLA
Frequent Visitor

My dates of the line chart are not filtering according to the tree map filter.

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.

IndrachapaLA_0-1662695415987.png

but It does not change when clicking 1month. Can you all please help.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@IndrachapaLA , 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

 

 

 

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @IndrachapaLA,

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@IndrachapaLA , 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

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.