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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
MDodds
Resolver II
Resolver II

Filter interacting with DAX Measure

Hi guys,

 

I am some Xero data pulling to report and a measure that displays the latest invoice amount which I then slice with customer data.

 

DAX measure below:

 

 

 

Last Invoice Amount = 
VAR LastSalesDate =
    CALCULATE (
        MAX ( 'Unique Invoices'[Date] ),
        FILTER ( 'Unique Invoices', 'Unique Invoices'[Type] = "ACCREC" )
    )
RETURN
    CALCULATE (
        [Total Invoice Amount],
        USERELATIONSHIP ( Dates[Date], 'Unique Invoices'[Date] ),
        FILTER ( Dates, Dates[Date] = LastSalesDate )
    )

 

 

 

 

The problem is I also slice the data by financial year. If I have the current financial year selected in the slicer, the above DAX works great. However if I have a previous financial year selected I get a blank result, obviously as the most recent invoice date is outside of that financial year.

Does anyone know how I could edit this to interact with the date slicer?

 

Cheers

2 REPLIES 2
djurecicK2
Super User
Super User

Hi @MDodds ,

 You can try using FILTER ( ALL(Dates), Dates[Date] = LastSalesDate )

Thanks djurecicK2.

This is about half way there. If I can't solve it fully I will go with this solution.
This displays the most recent invoice in the data, but essentially ignores the slicers. I want it to still operate with the slicers, so if I select FY2022 for example, it shows the last invoice in that year, not the last invoice in the full dataset.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors