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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Dave1mo1
Helper II
Helper II

How to Use AllExcept to Calculate Backlog & Allow for a Filter?

Hi,
 
I have the DAX below to calculate unit backlog for my company. However, I want to be able to filter it based on a "Business Unit" value. How can I preserve the syntax that retains the date filters appropriately to calculate backlog while still allowing me to filter? I tried "ALLEXCEPT," but can't get the syntax to work correctly.
 
If necessary, "Backlog" is defined as an order that's been booked but not yet invoiced as of the selected date.
 
Thank you!!!
 
Total Backlog =

CALCULATE(
    SUM(
'Order Data'[Units]),
FILTER(
    ALL(
        'Order Data'),
        'Order Data'[Booked Date] <MIN ('FY Date Table'[Date])
&&
OR('Order Data'[Invoice Date] >= MIN ('FY Date Table'[Date]), ISBLANK('Order Data'[Invoice Date]
)))
)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Dave1mo1 

 

As you understand, using “KEEPFILTER” in this measure requires changing your “Business Unit” data type to numeric type. If you prefer to use a text type, using “ALLEXCEPT” is more appropriate.

The DAX using “ALLEXCEPT” is as follows:

__Total Backlog = 
CALCULATE(
    SUM('Order Data'[Units]),
    FILTER(
        ALLEXCEPT('Order Data', 'Order Data'[Business Unit]),
        'Order Data'[Booked Date] < MIN('FY Date Table'[Date])
        &&
        OR(
            'Order Data'[Invoice Date] >= MIN('FY Date Table'[Date]),
            ISBLANK('Order Data'[Invoice Date])
        )
    )
)

 

Best Regards,
Jarvis Tang
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

8 REPLIES 8
Ray_Minds
Continued Contributor
Continued Contributor

Hi @Dave1mo1 
1.Create measure All Except = Calculate(sum(Data [sales]),ALLEXCEPT('Data' ,Data[sales],Data [Country]))

Ray_Minds_0-1724245162679.png
If your requirement is solved, please make THIS ANSWER a SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.

 

Anonymous
Not applicable

Hi @Dave1mo1 

 

Thank you for ahadkarimi reply and solution.

In addition to the use of “ALLEXCEPT” it is also possible to use “KEEPFILTER”, please allow me to add below.

_Total Backlog = 
CALCULATE(
    SUM('Order Data'[Units]),
    FILTER(
        'Order Data',
        'Order Data'[Booked Date] < MIN('FY Date Table'[Date])
        &&
        OR(
            'Order Data'[Invoice Date] >= MIN('FY Date Table'[Date]),
            ISBLANK('Order Data'[Invoice Date])
        )
    ),
    KEEPFILTERS('Order Data'[Business Unit])
)

 

Here is my test result, see uploaded pbix file for details.

vxianjtanmsft_0-1724132272935.png

 

 

 

Best Regards,

Jarvis Tang

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

Hi, and thanks for your response!

 

I am getting the following error:

 

MdxScript(Model) (289, 17) Calculation error in measure 'Measure Table' [Total Backlog]: Cannot convert value 'West' of type Text to type True/False.

 

Do I need to convert these business unit names to numerical values?

Anonymous
Not applicable

Hi @Dave1mo1 

 

As you understand, using “KEEPFILTER” in this measure requires changing your “Business Unit” data type to numeric type. If you prefer to use a text type, using “ALLEXCEPT” is more appropriate.

The DAX using “ALLEXCEPT” is as follows:

__Total Backlog = 
CALCULATE(
    SUM('Order Data'[Units]),
    FILTER(
        ALLEXCEPT('Order Data', 'Order Data'[Business Unit]),
        'Order Data'[Booked Date] < MIN('FY Date Table'[Date])
        &&
        OR(
            'Order Data'[Invoice Date] >= MIN('FY Date Table'[Date]),
            ISBLANK('Order Data'[Invoice Date])
        )
    )
)

 

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

This did it - thanks so much!

ahadkarimi
Solution Specialist
Solution Specialist

Hi @Dave1mo1, give this a try, and if you encounter any issues, let me know.

 

Total Backlog =
CALCULATE(
    SUM('Order Data'[Units]),
    FILTER(
        ALLEXCEPT('Order Data', 'Order Data'[Business Unit], 'Order Data'[Booked Date], 'Order Data'[Invoice Date]),
        'Order Data'[Booked Date] < MIN('FY Date Table'[Date]) &&
        OR('Order Data'[Invoice Date] >= MIN('FY Date Table'[Date]), ISBLANK('Order Data'[Invoice Date]))
    )
)

 

Did I answer your question?  If so, please mark my post as the solution!
Your Kudos are much appreciated!  Proud to be a Resolver III !

Hi, 

 

Thank you for your response! I'm getting the following error:

 

"A single value for column 'Booked Date' in table 'Order Data' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggreggation such as min, max, count, or sum to get a single result."

 

Any thoughts?

Hi @Dave1mo1, give this a try, and if you encounter any issues, let me know.

 

 

_Total Backlog =
CALCULATE(
    SUM('Order Data'[Units]),
    FILTER(
        ALLEXCEPT('Order Data', 'Order Data'[Business Unit]),
        MIN('Order Data'[Booked Date]) < MIN('FY Date Table'[Date]) &&
        OR(MAX('Order Data'[Invoice Date]) >= MIN('FY Date Table'[Date]), ISBLANK(MAX('Order Data'[Invoice Date])))
    )
)

 

Did I answer your question?  If so, please mark my post as the solution!✔️
Your Kudos are much appreciated!  Proud to be a Responsive Resident!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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