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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
adnaaan
Regular Visitor

Unable to Add Filter with DatesBeetween and Allexcept

Hi Folks,

 

I have been stuck with this issue for quite some time now.

Here is the measure:


OCR MAT Trend =
VAR LFLTenants =
    CALCULATETABLE (
        VALUES ( 'Financial Metrics'[Tenant Code] ),
        'Financial Metrics'[Is LFL MAT] = TRUE ()
    )
RETURN
    CALCULATE (
        [OCR],
        //'Tenants'[Tenant Code] IN LFLTenants,
        DATESBETWEEN (
            'Trend Date'[Date],
            NEXTDAY ( SAMEPERIODLASTYEAR ( LASTDATE ( 'Trend Date'[Date] ) ) ),
            LASTDATE ( 'Trend Date'[Date] )
        ),
        ALLEXCEPT ( 'Date', 'Date'[Date] )
    )

It's working fine as it is. I am using this measure to show Moving Annual Total Values for last 12 months.


But When I Remove the comments from this line,

        //'Tenants'[Tenant Code] IN LFLTenants,

It starts returning Moving Annual Total Value of Selected Month only, hence ignoring AllExcept Filter at all. According to my reserach, I am missing KeepFilters or RemoveFilters function somehow but not sure where.

5 REPLIES 5
V-lianl-msft
Community Support
Community Support

Hi @adnaaan ,

 

Try to update  ALLEXCEPT ( 'Date', 'Date'[Date] ) to ALLSELECTED('Date'[Date])

or

add KEEPFILTERS(Filter conditions affecting [OCR])

 

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

Hi @V-lianl-msft , Thanks for your time.

Changing AllExcept to AllSelected isn't working.

Before Making Change:

Before Changes with Filter CommentedBefore Changes with Filter Commented

 

After Enabling Filter:

After Enabling LFLTenants FilterAfter Enabling LFLTenants Filter

 

After Changing AllExcept to AllSelected:

After Changing AllExcept to AllSelectedAfter Changing AllExcept to AllSelected


Using Keepfilters:

Using KeepfiltersUsing Keepfilters

 



@Greg_Deckler Can you also please look into it?

Hi @adnaaan ,

 

Could you share the sample pbix via cloud service like onedrive for business?

Please remove any sensitive data before uploading.

 

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

amitchandak
Super User
Super User

@adnaaan , Tray a measure like this with Date table

 

Rolling 12 = CALCULATE([OCR],DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Hi Amit! Thanks for your reply.

But it's behaving the same way. As soon as I put LFLTenants filter in this calculate function after datesinperiod, It starts returning MAT of only Current Month.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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