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.
Hi all
I need to have the sumif from another table without duplicating the values.
In the example below a table called 'Template' has repeated the column Activity ID:
And another table called 'Summary' which should receive the sum of the hours of the table template without duplicates.
The column both tables have in column is 'merged'.
I am using the following dax:
Non Duplicate Hours Sum IF =
CALCULATE (
SUM(Template[Hours by Year]),
FIRSTNONBLANK ( Template[Activity ID], 1 ),
FILTER ( ALL ( Template ), Template[Merged] = 'Tech Collab'[Merged] )
)
However the result is not correct.
The result should be the sum of the non duplicated hours, which should be 1158 hours:
Any idea on how to fix my dax?
Thanks.
Solved! Go to Solution.
Hi @Ahmedx
Thank you, almost there. The only thing is that the table summary should not have the activity id.
Table Summary should just be merged column and your calculated column. Something like this circled:
Would it be possible?
Thanks.
Hi @Ahmedx
When I use the formula in my real table I get a lot of duplicates for different Merged values in the table summary.
Can you please copy and paste the attached values below in your data source?
The attach the xls contains the soution desired in the column 'hours'. Please notice I did the calculation manually just to represent the actual solution.
Thanks
By the way, the "DISTINCT" function is superfluous, you can remove it, it will not affect the result
It's ok.
Can you please use these 2 tables:
Template:
Activity ID | Hours by Year | Merged |
8 | 117 | DSTO |
8 | 117 | DSTO |
8 | 117 | DSTO |
8 | 117 | DSTO |
8 | 117 | DSTO |
8 | 117 | DSTO |
8 | 117 | DSTO |
1 | 386.1 | DSTO |
1 | 386.1 | DSTO |
1 | 386.1 | DSTO |
1 | 386.1 | DSTO |
1 | 386.1 | DSTO |
1 | 386.1 | DSTO |
1 | 386.1 | DSTO |
13 | 70.2 | DSTO |
13 | 70.2 | DSTO |
7 | 117 | DSTO |
7 | 117 | DSTO |
6 | 117 | DSTO |
6 | 117 | DSTO |
14 | 70.2 | DSTO |
14 | 70.2 | DSTO |
9 | 163.8 | DSTO |
9 | 163.8 | DSTO |
9 | 163.8 | DSTO |
9 | 163.8 | DSTO |
9 | 163.8 | DSTO |
9 | 163.8 | DSTO |
10 | 117 | DSTO |
10 | 117 | DSTO |
And Summary:
Merged |
DSTO |
Then create the relationship of 1:M from Merged to Merged.
Finally the table merged is where you should add your calculated column.
Hope this helps.
Thanks!
Hi @az38
Thanks for your reply.
Can Activity ID be added to your dax? This is because for example 2 different activivities could have the same hours (for example 10 and 10 hours).
With your dax it would only sum 10, however it should be 20 as the activitiy Id's are different.
In my dax I also put the lookup function because the table Summary should lookup the sumif from the table template.
The table summary that I already exists should have the measure:
Merged | Non Duplicate Hours Sum IF |
DSTO | 1158.3 |
Hope Im more clear.
Thanks.
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.