Forum Discussion
Display data for previous 4 quarters based on selected date in slicer
Hi, Gattinomio
You can try the following measure. If you want to achieve this effect, the relationship between the Date table and the Measure table cannot be activated, if you want to use this slicer to achieve the effect of filtering other visuals, you can use the Related, userrelationship function to activate the relationship.
previous 4 quarters flag =
VAR _startDate =
CALCULATE ( MIN ( 'Date'[Date] ) )
VAR _endDate =
CALCULATE ( MAX ( 'Date'[Date] ) )
VAR _date_diff = _endDate - _startDate
VAR _ture_endDate = _startDate + 365
VAR _re =
IF (
_date_diff <= 365,
IF (
SELECTEDVALUE ( 'Measure'[Date] ) >= _startDate
&& SELECTEDVALUE ( 'Measure'[Date] ) <= _endDate,
1,
0
),
IF ( SELECTEDVALUE ( 'Measure'[Date] ) > _ture_endDate, 0, 1 )
)
RETURN
_re
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Dear Yang,
many thanks for having taken the time to work on a solution for me and to have answered.
I'm currently traveling and I was not able to look at the solution you suggested in details yet. I will do so by the end of the week.
Many thanks again and have a nice day!