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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello,
I've been trying to figure this one out but its proving to be a bit tough...
What I need to do in DAX is a sum of the "Value" column only when the CHECK1 and CHECK2 columns for that employee are set to 0 in all the other rows for the selected Date range.
This is an example dataset:
EMPLOYEE ID | VALUE | CHECK | CHECK2 | DATE |
1 | 1 | 0 | 0 | 01/01/2019 |
1 | 1 | 0 | 0 | 02/01/2019 |
1 | 1 | 0 | 0 | 03/01/2019 |
1 | 1 | 0 | 0 | 04/01/2019 |
1 | 1 | 0 | 0 | 05/01/2019 |
1 | 1 | 0 | 0 | 06/01/2019 |
2 | 1 | 1 | 0 | 03/01/2019 |
2 | 1 | 0 | 0 | 04/01/2019 |
2 | 1 | 0 | 0 | 05/01/2019 |
2 | 1 | 0 | 0 | 06/01/2019 |
3 | 1 | 0 | 0 | 01/06/2019 |
3 | 1 | 0 | 1 | 02/06/2019 |
Thanks,
if I can provide any more info or explain the issue any further I'd be glad to do so
Solved! Go to Solution.
Hi @ixtilion,
I got this code to work on your sample data
Measure = VAR _t = ADDCOLUMNS ( VALUES ( 'Table'[EMPLOYEE ID] ); "c1"; CALCULATE ( SUM ( 'Table'[CHECK] ) ); "c2"; CALCULATE ( SUM ( 'Table'[CHECK2] ) ) ) VAR _tt = CALCULATETABLE ( VALUES ( 'Table'[EMPLOYEE ID] ); FILTER ( 'Table'; ( 'Table'[EMPLOYEE ID]; 0; 0 ) IN _t ) ) RETURN CALCULATE ( SUM ( 'Table'[VALUE] ); FILTER ( 'Table'; ( 'Table'[EMPLOYEE ID] ) IN _tt ) )
Regards,
S
Hi @ixtilion,
I got this code to work on your sample data
Measure = VAR _t = ADDCOLUMNS ( VALUES ( 'Table'[EMPLOYEE ID] ); "c1"; CALCULATE ( SUM ( 'Table'[CHECK] ) ); "c2"; CALCULATE ( SUM ( 'Table'[CHECK2] ) ) ) VAR _tt = CALCULATETABLE ( VALUES ( 'Table'[EMPLOYEE ID] ); FILTER ( 'Table'; ( 'Table'[EMPLOYEE ID]; 0; 0 ) IN _t ) ) RETURN CALCULATE ( SUM ( 'Table'[VALUE] ); FILTER ( 'Table'; ( 'Table'[EMPLOYEE ID] ) IN _tt ) )
Regards,
S
@sturlaws thanks a lot, it works perfectly and I learned something about using variables and tables in DAX expressions!
Im going to try it out in a real enviroment with a lot of rows and see how it performs, thanks for the insight 🙂
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
6 | |
3 | |
3 | |
3 |
User | Count |
---|---|
13 | |
11 | |
8 | |
8 | |
8 |