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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
SMEisMe
New Member

Power BI - Calculate Function - other filters

I have a data set that includes location, product number, product description, and on hand.   Looks like this:

Loc typeLocation CodeProduct NumberProduct DescriptionUOMOn Hand
DIS76123APPLECASE5
SUP2123APPLECASE15
CON35123APPLECASE10
DIS74456PIEEACH20
SUP2456PIEEACH20
CON35456PIEEACH20
DIS44456PIEEACH20
SUP2456PIEEACH20
CON63456PIEEACH20

 

I have then used the Calculate Function to aggreate the data. 

CALCULATE(
    sum('Inventory Viewer UOM'[On Hand])
    ,ALLEXCEPT('Inventory Viewer UOM'
        ,'Inventory Viewer UOM'[LOCATIONCODE]
        ,'Inventory Viewer UOM'[Loc Type]
        ,'Inventory Viewer UOM'[Sale UOM]
        ,'Inventory Viewer UOM'[Product Number]
    )
 
Which results in the below exactly like I want it to.
Loc typeUOMTotal
CONCASE10
CONEACH40
CON Total50
DISCASE5
DISEACH40
DIS Total 45
SUPCASE15
SUPEACH40
SUP Total 55

 

The issue comes in that I want the user to be able to filter on both the Product Number and Product Description seperately.  When the user filters on Product Number, the correct data shows because Product Number is in the Calculate function.  When the User filters on Product Description, the data is not filtered down, I'm assuming because it is not in the Calculate Function.  Is there a way that I can have the Product Description filter without adding it to the calculate function?

 

1 ACCEPTED SOLUTION
ray_aramburo
Super User
Super User

Just use it within the measure, that will give you the right totals:

ray_aramburo_0-1710948272552.png

 

ray_aramburo_1-1710948307321.png

New Measure = CALCULATE(
    sum('Inventory Viewer UOM'[On Hand])
    ,ALLEXCEPT('Inventory Viewer UOM'
        ,'Inventory Viewer UOM'[Location Code]
        ,'Inventory Viewer UOM'[Loc Type]
        ,'Inventory Viewer UOM'[UOM]
        ,'Inventory Viewer UOM'[Product Number], 'Inventory Viewer UOM'[Product Description]
    ))

I attach you my sample file for your reference





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
SMEisMe
New Member

Thank you for this response and I agree this answer does work, however I was looking for a way for the filtering to work without putting the column into the Calcuate function.  My acutal project has too many fields to include in each of the Calculate functions.  Things like Location Name, Location Description, Product Category, Product Supplier, etc etc.  I'd like to know if there is a way for the filters to operate on the data without including them in the Calculate function?  Or maybe the calculate function is the incorrect way to aggreate this data to make the filtering work the way I need it to?

You don't need to include all of the fields in a CALCULATE function. You can just create a simple SUM column and your visuals and filters will determine your totals. These will change according to the granularity of your visual/table. If you want to go beyond that, you can create field parameters to even filter/let the user select which fields he wants to display. 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





ray_aramburo
Super User
Super User

Just use it within the measure, that will give you the right totals:

ray_aramburo_0-1710948272552.png

 

ray_aramburo_1-1710948307321.png

New Measure = CALCULATE(
    sum('Inventory Viewer UOM'[On Hand])
    ,ALLEXCEPT('Inventory Viewer UOM'
        ,'Inventory Viewer UOM'[Location Code]
        ,'Inventory Viewer UOM'[Loc Type]
        ,'Inventory Viewer UOM'[UOM]
        ,'Inventory Viewer UOM'[Product Number], 'Inventory Viewer UOM'[Product Description]
    ))

I attach you my sample file for your reference





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors