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.
I have line charts that I want to show the last 6 months based on the date filter. how can I do that?
Hi, @sonya7
You can try the following methods.
Sample data:
Create a new date table as a slicer.
Date table:
Date = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))
Measure =
Var Maxdate=SELECTEDVALUE('Date'[Date])
Var Mindate=eomonth(Maxdate, -6)
return
IF(SELECTEDVALUE('Table'[Date])>=Mindate&&SELECTEDVALUE('Table'[Date])<=Maxdate,1,0)
Put the measure in the line chart and set equal to 1.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
it worked but why is it showing more than 6 months months? a metric is required to give the last 6 months of that year
@sonya7 , If you want select a date and then want to show 6 month data, the slicer needs to be on an independent date table
example
//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -6) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
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 |
---|---|
96 | |
92 | |
81 | |
70 | |
64 |
User | Count |
---|---|
115 | |
106 | |
96 | |
81 | |
72 |