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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AmazingRandom
Helper I
Helper I

Creating a filter for the last two weeks of data

I have a client request about displaying a table with the last two weeks (today included) as the default. I have tried messing around with slicers but never managed to have them both work together as one would nee dot be offsetting the other. While searching for options I stumbled upon a possible way around it, creating a custom table with two rows, one being a last two weeks and the other all. 

 

Then a measure was used to calculate such value and turn it into a filter. However, on that formula I'm having issues replacing the generic table/column names. If anyone could point me out in the right direction or have another solution, I'd be thankful. 

Below is the measure formula:

Measure = IF(SELECTEDVALUE('Table (3)'[default value])="!previous 45 days",CALCULATE(SUM('Main table'[Value]),FILTER('Calendar',[Date]<=TODAY()&&[Date]>=TODAY()-44)),SUM('Main table'[Value]))




2 REPLIES 2
danextian
Super User
Super User

Hi @AmazingRandom ,

 

You can use a disconnected dates table and a measure to filter  just the last two weeks of dates. This approach if the date column is in a table or used as row header in a matrix is it behaves unexpectedly when used as column header when other dimension columns are added. The other approach is to create a modified table that has a date column and another dates column containing the last two weeks of date referencing the currrent row in the original date column something like below:

danextian_0-1713223336043.png

Please see attached pbix for your reference.

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

It is not working for me, I set up the tables but when I apply the filter to my table it returns nothing

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.