Forum Discussion
Display last 4 weeks data based on selected week
- 9 years ago
Hi MaxTrumblay
Create a Date table but don't link it to your main data table. Make sure your new date table has a week starting column that matches your data table.
Then simply create this measure on your data table and add it as a filter on your bar chart.
Date Range Filter = IF( MAX('Table1'[Date]) <= MIN('Dates'[WeekStarting]) && MAX('Table1'[Date]) >= MIN('Dates'[WeekStarting])-21 -------------------------------------------------------- , 1 , 0)Here is a link to a PBIX file so you can see it working
Hi MaxTrumblay
Create a Date table but don't link it to your main data table. Make sure your new date table has a week starting column that matches your data table.
Then simply create this measure on your data table and add it as a filter on your bar chart.
Date Range Filter = IF(
MAX('Table1'[Date]) <= MIN('Dates'[WeekStarting])
&& MAX('Table1'[Date]) >= MIN('Dates'[WeekStarting])-21
--------------------------------------------------------
, 1 , 0)Here is a link to a PBIX file so you can see it working
Thanks a lot Phil_Seamark for the fast reply. It's not working but I am assuming it because the interaction of my calendar and my database are not correctly done. I think I need to solve that issue by rethinking the way the database will be populated then it will work properly.
Best regards,
Max
- Phil_Seamark9 years agoMicrosoft EmployeeYou can have more than one calendar table. Did you try my PBIX file?
- MaxTrumblay9 years agoFrequent Visitor
Hi Phil_Seamark,
Yes, I tried it. I understand the logic, unfortunately, I'm not able to replicate it for my situation. Probably only an interaction problem. my METRICS table (table1 in your case) is using DateID and is linked to my DATE table with a DateID. I don't know how I can use a new date table and make it work only using one filter (from my DATE table).Thanks in advance,
Max
- Phil_Seamark9 years agoMicrosoft Employee
I think the key is to not use your existing date table.
I'd suggest using a different table to your main Date table (you can have more than one)