Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi everyone,
I just started working with DAX and I came across something and I'm a bit stuck.
Is there any way to use a filter function when using group by? I've been searching for it for days but couldn't find anything.
I would like to group my data by date, usr_id, shift, rate_type and
do a sum of the total seconds column where column rate type starts with "replens" and column actcod="GENMOV" and "CASRPL"
do a count of rows where column actcod = "CASRPL" and column Time over/under = "Time Under 5".
What i am struggling to understand is how to apply a different fitler for those 2 aggregations
I want a filter on sum and a different filter on count.
Thanks.
Solved! Go to Solution.
Hello:
Here is one way to do this.
TWO CALC COLUMNS
A = IF(
AND( LEFT( Table[rate-type], 7) = “replens”,
Table[actcod] = “GENMOV”),
SUM(Table[Total Seconds], BLANK()
)
B =IF(
AND(Table[actcod] = “CASRPL”,
Table[Time over/under] = “Time Under 5”),
1), BLANK()
)
TWO Measures
Sum A = SUM(Table[A])
SumB =SUM(Table[B])
You could potentially just have two measures where you can have variables for the conditions
But here you can see what is occurring a bit easier.
Hello:
Here is one way to do this.
TWO CALC COLUMNS
A = IF(
AND( LEFT( Table[rate-type], 7) = “replens”,
Table[actcod] = “GENMOV”),
SUM(Table[Total Seconds], BLANK()
)
B =IF(
AND(Table[actcod] = “CASRPL”,
Table[Time over/under] = “Time Under 5”),
1), BLANK()
)
TWO Measures
Sum A = SUM(Table[A])
SumB =SUM(Table[B])
You could potentially just have two measures where you can have variables for the conditions
But here you can see what is occurring a bit easier.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 18 | |
| 12 | |
| 11 | |
| 6 | |
| 6 |