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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Running count with a filter

Hi all, 

 

Not sure if this is because it's a New Year and my brain has yet to accept it, or if it's actually something that's going to be difficult! 

 

I have the following:

RunningTot = 
CALCULATE(
    DISTINCTCOUNT('Location'[ID]),
    FILTER(
        ALLSELECTED('Location'[ID]),
        ISONORAFTER('Location'[ID], MIN('Location'[ID]), ASC)
    )
)

Works perfectly, counts the staff, tells me how many they are in each location

 

However, I now want to add in an additional complication.

 

On this table there is also a location field - which varies between office, field, home-based, flexible - and allows for multiple ticks for each staff member (as it's where they are willing to be). What I want to do is break down my above count, so that it only counts those that are ticked as 'flexible' but then reports back on the other locations as well. So, outcomes being out of everyone that is 'flexible' - 9 are home-based too, 14 are field, 2 are office - duplication of counts doesn't matter in this instance. 

 

I can't use a filter in the report as if I tick flexible, it will just show those that are ticked as that and disregard the other locations (which is what I want to report back on).

 

Hopefully this makes sense

 

Thanks for any guidance 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@amitchandak Thanks for trying to help with this - however, I have woken up a bit now and made a custom column that allows 'flexible' to act as a seperate filter (instead of trying to do it in the same column).

 

All works now! Thanks again for trying to help, greatly appreciated. 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Check if Window function can help

 

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

https://youtu.be/cN8AO3_vmlY?t=31980

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
Anonymous
Not applicable

@amitchandak Thanks for trying to help with this - however, I have woken up a bit now and made a custom column that allows 'flexible' to act as a seperate filter (instead of trying to do it in the same column).

 

All works now! Thanks again for trying to help, greatly appreciated. 

Anonymous
Not applicable

To give a quick example as I can't attach on my current slow connection.

 

1office
1field
2home-based
3home-based
3field
4home-based
4field
4flexible
5flexible
5home-based
5office
5field

 

So, the normal counts would be

Office - 2

Field - 4

Home-based - 4

Flexible - 2

 

But then we would filter on the flexible field so the count would be (just ids 4 & 5 are marked as flexible)

Office - 1

Field - 2

Home-based - 2

Flexible - 2

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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