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
eliasayyy
Memorable Member
Memorable Member

Matrix Filtering is Confusing please help

Hello everyone, i cant seem to understand the logic behind the filtering in matrix

i am adding a measure called weekcheck to filter out dates based on a number range paramater to go back x number of weeks compared to today's week

Week check = 
VAR ReferenceDate =
    CALCULATE(MAX( dimDate[StartOfWeek] ), REMOVEFILTERS(dimDate))
VAR NumDays =
    SELECTEDVALUE ( Parameter[Parameter] ) * 7
RETURN
    IF ( ( ReferenceDate - NumDays ) <= MAX(dimDate[StartOfWeek]), 1 )

 

if i do the matrix like this i get the results i need

eliasayyy_1-1759826096600.png

 



however the way i want to display it is putting the startofweek in the column of the matrix not row

and as soon as i do this, the filter breaks and doesnt work

eliasayyy_2-1759826178130.png



as you see i have way more data back from the start of my dataset?

why is this happening and how to fix it please





1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @eliasayyy 

Try creating a filtered measure instead

Filtered Measure =
VAR ReferenceDate =
    CALCULATE ( MAX ( dimDate[StartOfWeek] ), REMOVEFILTERS ( dimDate ) )
VAR NumDays =
    SELECTEDVALUE ( Parameter[Parameter] ) * 7
VAR StartDate = ReferenceDate - NumDays
RETURN
    CALCULATE ( [your measure], KEEPFILTERS ( dimDate[StartOfWeek] >= StartDate ) )




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"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.

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

I have solved a similar question (based on months) in the attached PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-sshirivolu
Community Support
Community Support

Hi @eliasayyy ,

I would also take a moment to thank @danextian  , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions

 

Hi @eliasayyy ,

I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.

 

danextian
Super User
Super User

Hi @eliasayyy 

Try creating a filtered measure instead

Filtered Measure =
VAR ReferenceDate =
    CALCULATE ( MAX ( dimDate[StartOfWeek] ), REMOVEFILTERS ( dimDate ) )
VAR NumDays =
    SELECTEDVALUE ( Parameter[Parameter] ) * 7
VAR StartDate = ReferenceDate - NumDays
RETURN
    CALCULATE ( [your measure], KEEPFILTERS ( dimDate[StartOfWeek] >= StartDate ) )




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"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.

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.