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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
penguin_96
New Member

Dynamic Date Filtering

Hi All
New to power BI and am trying to build a report. I am build a marketing dashboard. It has slicer values google, Facebook, BD, Non-BD etc.

below it I have a matric table wherein I have added month_year in rows, r_value (its basically numbers from 1 to x signifying number of months after month year value) and values in the data.

 

I have to filter this data. As of now I am using the filter pane adding month_year to it and opting for relative date to filter the values for the last 8 years. The data being shown after this is perfectly correct. Now the issue is I want to see last 8 years of data for google BD and Non-BD but not for facebook. I was to see last 2 years data for facebook. Also, more data will be added in table and overall slicer like whatsapp, appnext etc which too would require filtering of 1 yrs or 2 yrs. Is there a way to dynamically filter this. 

I tried this measure:

Avg_Exits %% =
VAR year_number = [Years to Filter] (a column I have created that gives numerical value when a slicer value is selected indicating number of years)

return
CALCULATE(AVERAGEX(VALUES(Exits[month_year]),[Exits%]), DATESBETWEEN(Exits[month_year], DATE(YEAR(TODAY())-year_number,MONTH(TODAY()),DAY(TODAY())),TODAY()))

and it is working perfectly well for basic table. In case of matrix similar approach is not working. It is filtering my column values but not my row values. This is the measure I tried

Exits %% =
VAR year_number = [Years to Filter]

return
CALCULATE(DIVIDE(SUM(Exits[exits]), CALCULATE(SUM(Exits[exits]), exits[r] = 1)), DATESBETWEEN(Exits[month_year], DATE(YEAR(TODAY())-year_number,MONTH(TODAY()),DAY(TODAY())),TODAY()))

 

 

 

Any advice on what can be done?


1.png

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.