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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Matrix is not properly filtering with measure

Hi! There is this problem. I created a sample of data and a simple measure.

Ana__0-1643361287969.png

Ana__1-1643361312009.png


And now when I filter this matrix, all dates are still there:

Screenshot_1.png

 
 
 








How can I change the measure with this logic (I want to see 0 if spend is empty) so that it will be filtering as with regular sum:
Screenshot_1.png

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Test like below:

1.create a date table:

Date = CALENDAR("2021,1,1","2021,12,31")

 

2.create relationship:

vluwangmsft_0-1644222228095.png

 

3.create the below measure:

qq = 
VAR maxdate =
    CALCULATE ( MAX ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) )
VAR mindate =
    CALCULATE ( MIN ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) )
RETURN
    IF (
        MAX ( 'Table'[date] ) < mindate
            || MAX ( 'Table'[date] ) > maxdate,
        BLANK (),
        IF (
            MAX ( 'Table'[date] ) >= mindate
                && MAX ( 'Table'[date] ) <= maxdate,
            MAX ( 'Table'[spent] ) + 0,
            BLANK ()
        )
    )

 

Final get:

vluwangmsft_1-1644222270969.png

vluwangmsft_2-1644222290166.png

 

 

 

You could download my pbix file if you need!

 

 

 

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


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Test like below:

1.create a date table:

Date = CALENDAR("2021,1,1","2021,12,31")

 

2.create relationship:

vluwangmsft_0-1644222228095.png

 

3.create the below measure:

qq = 
VAR maxdate =
    CALCULATE ( MAX ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) )
VAR mindate =
    CALCULATE ( MIN ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) )
RETURN
    IF (
        MAX ( 'Table'[date] ) < mindate
            || MAX ( 'Table'[date] ) > maxdate,
        BLANK (),
        IF (
            MAX ( 'Table'[date] ) >= mindate
                && MAX ( 'Table'[date] ) <= maxdate,
            MAX ( 'Table'[spent] ) + 0,
            BLANK ()
        )
    )

 

Final get:

vluwangmsft_1-1644222270969.png

vluwangmsft_2-1644222290166.png

 

 

 

You could download my pbix file if you need!

 

 

 

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


Best Regards

Lucien

amitchandak
Super User
Super User

@Anonymous , Based on what I got. You want 0 only when it blank between range. Try a measure like

 

0 between range
Measure = var _1= SUM(Opportunity[Opportunity count]) +0
var _min = minx(ALLSELECTED('Calendar'), 'Calendar'[Date])
var _max = maxx(ALLSELECTED('Calendar'), 'Calendar'[Date])
return
CALCULATE(if(max('Calendar'[Date]) <_min || max('Calendar'[Date]) >_max , BLANK(), _1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.