Forum Discussion
WishAskedSooner
Continued Contributor
1 year agoMaking Chart Filter Dynamic
Hi Experts! I am getting quite close to a complete solution to my problem. I am playing around in the Adventure Works PBIX. I created a YTD vs PY YTD line chart for Sales[Sales Amount]. To do thi...
- Anonymous1 year ago
Hi WishAskedSooner ,
Thanks to lbendlin , Kedar_Pande and dk_dk for their interest in this issue. I have some other thoughts to add:
Based on your description, you want the filter to be dynamic, right?
Here is my test data:We can create a measure.
Flag = var _slicer=SELECTEDVALUE('Sales'[Category]) var _max_date=CALCULATE(MAX('Sales'[Date]),FILTER(ALLSELECTED('Sales'),'Sales'[Category]=_slicer)) var _max_year=YEAR(_max_date) RETURN IF(ISFILTERED('Sales'[Category])=FALSE() || YEAR(MAX('Date'[Date]))=_max_year,1,0)Place [Flag=1] on the visual object's filter. Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
dk_dk
Super User
1 year agoHi WishAskedSooner (great username! 😄 )
You could do this by creating a calculated column:
InCurrYear = YEAR('DateUnconn'[Date]) = YEAR(TODAY())
This will evaluate to True for all date values that are in the current year, and False for all others. You can then add this column as a visual or page level filter.
Hope this helps!