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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Filter a matrix on dates calculated in measures

Hello,

I have a date table D_DATES with the columns: DATE_ID, DATE and WEEK
The column WEEK contains the date of the beginning of the week (Monday) of the date 

 

D_DATES.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I  use a slicer that is based on the column DATE

 

Date_Slicer.png

 

 

 

 

 

Based on this slicer I calculate following measures
The first calculates the date of the Monday of the week in which the selected minimum date of the slicer belongs

The second calculates the date of the Sunday of the week in which the selected maximum date of the slicer belongs

 

Week Begin Selected Minimum Date =
VAR _mindate_ =
       CALCULATE(
              MIN(D_DATES[DATE]);
              ALLSELECTED(D_DATES[DATE])
       )
VAR _weekday_ = WEEKDAY(_mindate_; 2)    -- 1 = Monday ... 7 = Sunday
RETURN
_mindate_ - _weekday_ + 1

 

Week End Selected Maximum Date =
VAR _maxdate_ =
CALCULATE(
MAX(D_DATES[DATE]);
ALLSELECTED(D_DATES[DATE])
)
VAR _weekday_ = WEEKDAY(_maxdate_; 2)
RETURN
_maxdate_ - _weekday_ + 7

 

e.g.
I choose in the date slicer the minimum date 18/3/2021, this date is part of the week that starts on Monday 15/3/2021
I choose in the date slicer the maximum date 23/8/2021, this date is part of the week that ends on Sunday 29/08/2021

If I show the values of these measures in cards:
Date_Slicer_Week.png

 

 

 

 

 

 

I have an other table F_AMOUNTS with the columns: PK_AMOUNT, LEVEL, REGION, DATE and AMOUNT


D_AMOUNTS.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Data model

 

Data_model.png

 

 

The data from this table I show in a Matrix
Rows

       F_AMOUNTS[REGION]

       F_AMOUNTS[LEVEL]

Columns

       D_DATES[WEEK]

Values

       F_AMOUNTS[AMOUNT]

Matrix.png

Is there a way to filter this Matrix on the two measures [Week Begin Selected Minimum Date] and [Week End Selected Maximum Date]?

For example by setting an other date slicer on these two values and use that slicer to filter the matrix. (just a suggestion if this is possible)

 

Anybody has an idea?

 

Thanks,

 

R.W.

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can try to create a measure using the if statement and apply it to the visual level filter of this matrix.

The masure may like this:

measure = 
if(
    max(D_DATES[WEEK])>=[Week Begin Selected Minimum Date]&&
    max(D_DATES[WEEK])<=[Week End Selected Maximum Date],
1,
0 
)

 

Drag this measure into the visual level filter of the matrix and set the filter condition equal to 1

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can try to create a measure using the if statement and apply it to the visual level filter of this matrix.

The masure may like this:

measure = 
if(
    max(D_DATES[WEEK])>=[Week Begin Selected Minimum Date]&&
    max(D_DATES[WEEK])<=[Week End Selected Maximum Date],
1,
0 
)

 

Drag this measure into the visual level filter of the matrix and set the filter condition equal to 1

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors