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
moatazbelah
Regular Visitor

Filter on Subtotals values

I'm trying to filter on the subtotals value. But the filter happens on the actual values. So in the pictures below, I'm trying to filter on 88555. But when I put that in the filter, I don't get anything. And when I put 8000 in the filter which is value, not the total, it worked. But I want to filet on the subtotal, not the value. 

 

Screenshot (391).png

Screenshot (389).png

Screenshot (390).png

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @moatazbelah ,

 

Power BI doesn't support us to filter Subtotal in Filter Field directly. As you test, we could only filter actual value by Filter Field. If you want to use Subtotal as a category and filter it, I suggest you to create an unrelated Slicer table, then create a measure and add this measure in visual level filter.

My Sample:

1.png

Subtotal Table:

Subtotal = GENERATESERIES(1, SUM('Table'[Total]))

Measure:

Filter Subtotal = 
VAR _Subtotal =
    CALCULATE (
        SUM ( 'Table'[Total] ),
        ALLEXCEPT ( 'Table', 'Table'[Order Number] )
    )
VAR _SELECTVALUE =
    MAX ( Subtotal[Value] )
RETURN
    IF ( ISFILTERED ( Subtotal[Value] ), IF ( _Subtotal = _SELECTVALUE, 1, 0 ), 1 )

Add this measure into visual level filter in matrix visual and set it to show items when value =1.

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

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

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hi @moatazbelah ,

 

Power BI doesn't support us to filter Subtotal in Filter Field directly. As you test, we could only filter actual value by Filter Field. If you want to use Subtotal as a category and filter it, I suggest you to create an unrelated Slicer table, then create a measure and add this measure in visual level filter.

My Sample:

1.png

Subtotal Table:

Subtotal = GENERATESERIES(1, SUM('Table'[Total]))

Measure:

Filter Subtotal = 
VAR _Subtotal =
    CALCULATE (
        SUM ( 'Table'[Total] ),
        ALLEXCEPT ( 'Table', 'Table'[Order Number] )
    )
VAR _SELECTVALUE =
    MAX ( Subtotal[Value] )
RETURN
    IF ( ISFILTERED ( Subtotal[Value] ), IF ( _Subtotal = _SELECTVALUE, 1, 0 ), 1 )

Add this measure into visual level filter in matrix visual and set it to show items when value =1.

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

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

truptis
Community Champion
Community Champion

@moatazbelah -> for filtering the subtotal, you need to put the subtotal field/measure etc in your filters pane. Only then it will filter. It is not really possible to filter it with a value. 

You can filter it on a categorical variable like in your case it is order_id

truptis
Community Champion
Community Champion

@moatazbelah i am not quite clear about what your ask is. Could you please tell your requirement? 

 

Also, putting a filter on total value = 88555 is kind of a hard coding. 

So it would be great if you could share your exact requirement for a better solution

@truptis Hi Truptis, what I'm trying to do is to filter on 88555. But it doesn't work, because it's subtotal. So is there a way that I can filter on subtotal?  

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