Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi All,
I would like some help on this one as I cannot figure it out.
I have a regular date range slicer for Date.
I want to show the last 3 month from the max selected date in the slicer (not current date). I want to show the results in a line chart.
Ex. Selected Slicer Value: 2020-07-01, the range in line chart shows 2020-05-02 to 2020-07-01
I have the following calculation but the line chart is still showing for the full date range:
Sales Last 60 d =
var Ldate = MAX('Date'[Date]) //Last date
var Fdate = (Ldate-60) // last 60 days
return
calculate([Sales Total],
FILTER (
Sales,
RELATED('Date'[Date]) >= Fdate )))
Thanks!
Solved! Go to Solution.
Hi @Anonymous ,
We can create a date table and a measure to meet your requirement.
The date table has no relationship with sales table.
1. Create a date table to be a slicer.
Date = CALENDAR("2020/1/1","2020/8/1")
2. Then we can create a measure.
Sales Last 60 d =
var _SelectDate = SELECTEDVALUE('Date'[Date])
var _Fdate = _SelectDate-60
var _result =
calculate(
SUM('Sales table'[Sales]),
FILTER (
'Sales table',
'Sales table'[Date]<=_SelectDate && 'Sales table'[Date] >=_Fdate))
return
IF(
ISBLANK(_SelectDate),SUM('Sales table'[Sales]),_result)
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
How about the result after you follow the suggestions mentioned in my original post?
Could you please provide more details or expected result about it If it doesn't meet your requirement?
If you've fixed the issue on your own please kindly share your solution.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
We can create a date table and a measure to meet your requirement.
The date table has no relationship with sales table.
1. Create a date table to be a slicer.
Date = CALENDAR("2020/1/1","2020/8/1")
2. Then we can create a measure.
Sales Last 60 d =
var _SelectDate = SELECTEDVALUE('Date'[Date])
var _Fdate = _SelectDate-60
var _result =
calculate(
SUM('Sales table'[Sales]),
FILTER (
'Sales table',
'Sales table'[Date]<=_SelectDate && 'Sales table'[Date] >=_Fdate))
return
IF(
ISBLANK(_SelectDate),SUM('Sales table'[Sales]),_result)
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous - My Complex Selector quick measure provides an example of this scenario almost exactly.
https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Complex-Selector/td-p/1116633
Can I download the sample to try it out myself?
I dont understand why something like this is not available out of the box?
Appreciate further help in this.
Thanks
User | Count |
---|---|
128 | |
108 | |
100 | |
64 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |