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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
jbrijalba
Helper I
Helper I

Filtering using an aggregation

I have a report looking at credit card spending for the company I work at. The CAO wants to see employees who spent over $20,000 over a period (ex: Dec 21st thru Jan 20th). I put a filter on spend amount is greater or equal to $20,000 for the visualization. What happens, is only transactions with amounts over $20,000 show up. I need it to be an aggregated amount per employee that spends over $20,000. 

 

Have slicer for period.

Have matrix with employee spend.

Need an aggregated filter on spend over $20,000 that shows employees spend over $20,000, not transaction level.

 

Please help. Don't know why I can't figure this out my self. Check out pic for more support/info.

JK Overview.PNG

 

5 REPLIES 5
amitchandak
Super User
Super User

Try like


calculate(countx(filter(SUMMARIZE(
data,
data[employee ID],
"sum_exp",
Sum( 'Date'[expense]),
"Max_ID", max(data[employee ID])
),sum_exp>20000), Max_ID))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Didn't work. I should have mentioned that in the Matrix I have Carholder name and Vendor name in the row slot and amount in the value. Sorry for leaving that out.

 

Also, was it supposed to give me 1s and 0s?

Refer this formula.

 

Total value = Calculate(
    count(data[employee ID]),
    FILTER(  
        ADDCOLUMNS( 
            SUMMARIZE(
                data,
                data[employee ID],
				"sum_exp",
				Sum( 'Date'[expense]),
                "Max_ID", max(data[employee ID])
            ),
            "Over20K",
            calculate(
                sum(data['Date'[expense]),
                filter(
                    all(data),
                    data[employee ID]= [Max_ID]  )
                )
            )
        ,[Over20K]>20000
    )
)

 

In this formula, you can use summarize to build your filter not the value. so value should work at different level

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @jbrijalba

 

Could you pls show me part of your data?I can't test without data...

 

Best Regards,

Kelly

It is extremely confidential and would take a while to make a dummy dataset. I ended up removing vendor from the matrix and using the advanced filter >= 20,000. Works but do not have the drill down capabilities but the graph is of vendor spend so it works, sort of. I will provide dummy data if I find time. Thank you for your help.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.