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
Dom_Smith825
Frequent Visitor

dax measure with ALL( DatesTable) does not ignore date filter

Hi Folks,

 

I want to calculate:
AccountsReceivable = CALCULATE( SUMX( FACT_Actuals_Master, (FACT_Actuals_Master[Credits] - FACT_Actuals_Master[Debits]) )
 
I also need to add the filter FILTER( FACT_Actuals_Master, [Account Master Name] = "Accounts Receivable")
 
I also want to ignore any filtering coming from the relationship Datestable[DATE] = FACT_Actuals_Master[Date]

I have: AccountsReceivable =  CALCULATE( SUMX( FACT_Actuals_Master, (FACT_Actuals_Master[Credits] - FACT_Actuals_Master[Debits]) ),
FILTER( FACT_Actuals_Master, [Account Master Name] = "Accounts Receivable"),
ALL(DatesTable) )

There is a DatesTable[MonthYear] in the filters pane acting on all pages, when it is used, the AccountsReceivable total changes, but is should remain constant.

Any thoughts/pointers?
 
Thanks
1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

Please try this version.

Converted_AR2 =
VAR SelectedRate =
    SWITCH (
        TRUE (),
        [SelectedCurrency] = "CAD", 1,
        [SelectedCurrency] = "EUR", P_EUR_to_CAD_Rate[EUR_to_CAD_Rate_Value],
        [SelectedCurrency] = "INR", DIVIDE ( 1, P_INR_to_CAD_Rate[INR_to_CAD_Rate_Value] ),
        [SelectedCurrency] = "USD", P_USD_to_CAD_Rate[USD_to_CAD_Rate_Value],
        BLANK ()
    )
VAR ExchangeRate =
    IF (
        MAX ( DatesTable[Date] ) > Labels[Ledger_LatestDate],
        SelectedRate,
        [Exchange_Rate_Normalised]
    )
VAR AccountsReceivable =
    CALCULATE (
        SUMX (
            FACT_Actuals_Master,
            ( FACT_Actuals_Master[Credits] - FACT_Actuals_Master[Debits] )
        ),
        FACT_Actuals_Master[Account Master Name] = "Accounts Receivable",
        ALL ( DatesTable )
    )
RETURN
    AccountsReceivable * ExchangeRate * -1

 

Pat

Microsoft Employee

View solution in original post

5 REPLIES 5
ppm1
Solution Sage
Solution Sage

Please try this version.

Converted_AR2 =
VAR SelectedRate =
    SWITCH (
        TRUE (),
        [SelectedCurrency] = "CAD", 1,
        [SelectedCurrency] = "EUR", P_EUR_to_CAD_Rate[EUR_to_CAD_Rate_Value],
        [SelectedCurrency] = "INR", DIVIDE ( 1, P_INR_to_CAD_Rate[INR_to_CAD_Rate_Value] ),
        [SelectedCurrency] = "USD", P_USD_to_CAD_Rate[USD_to_CAD_Rate_Value],
        BLANK ()
    )
VAR ExchangeRate =
    IF (
        MAX ( DatesTable[Date] ) > Labels[Ledger_LatestDate],
        SelectedRate,
        [Exchange_Rate_Normalised]
    )
VAR AccountsReceivable =
    CALCULATE (
        SUMX (
            FACT_Actuals_Master,
            ( FACT_Actuals_Master[Credits] - FACT_Actuals_Master[Debits] )
        ),
        FACT_Actuals_Master[Account Master Name] = "Accounts Receivable",
        ALL ( DatesTable )
    )
RETURN
    AccountsReceivable * ExchangeRate * -1

 

Pat

Microsoft Employee

@ppm1  Thanks ppm1, that works perfectly for me.

Dom_Smith825
Frequent Visitor

@Greg_Deckler I think I've shared a sample database with you here: https://www.dropbox.com/s/lhmjui5bmkgsri2/AR%20Database.pbix?dl=0

New to this, may not have done this properly.

Dom_Smith825
Frequent Visitor

@Greg_Deckler, thanks, I'll take a look at that and if I can't see anything obvious I'll set up a pbix replicating the problem.

Greg_Deckler
Super User
Super User

@Dom_Smith825 It's hard to be certain what is going on here. Sometimes these kinds of issues are caused by the Auto-exist "feature".


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors