Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I need to sum the distinct values in the headcount column and get the sum in every row in another column , this is some data to work on. i'm using
| Amount | Headcount | Distinct sum headcount |
| 11,970 | 7 | 27 |
| 6,152 | 7 | 27 |
| 6,552 | 7 | 27 |
| 17,500 | 7 | 27 |
| 13,678 | 6 | 27 |
| 18,432 | 6 | 27 |
| 5,161 | 6 | 27 |
| 7900 | 6 | 27 |
| 97400 | 1 | 27 |
| 2666 | 1 | 27 |
| 8989 | 1 | 27 |
| 3,168 | 1 | 27 |
| 1,047 | 13 | 27 |
| 2899 | 13 | 27 |
| 19,171 | 13 | 27 |
| 6,773 | 13 | 27 |
Solved! Go to Solution.
Hi @Anonymous ,
You also need to add the year to the filtering:
Measure =
VAR temp_table =
FILTER (
SUMMARIZE ( ALL ( 'Table' ); 'Table'[DAte]; 'Table'[Headcount] );
'Table'[Month] = SELECTEDVALUE ( 'Table'[Month] ) &&
'Table'[Year] = SELECTEDVALUE ( 'Table'[Year] )
)
RETURN
CALCULATE ( SUMX ( temp_table; 'Table'[Headcount] ) )
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous ,
You can try the following measure:
Measure =
VAR temp_table =
FILTER (
SUMMARIZE ( ALL ( 'Table' ); 'Table'[DAte]; 'Table'[Headcount] );
'Table'[DAte] = SELECTEDVALUE ( 'Table'[DAte] )
)
RETURN
CALCULATE ( SUMX ( temp_table; 'Table'[Headcount] ) )
Be aware that you don't refer if the date is based I have made an example with all dates being the same for the same period, but you can change the filtering to add the month / year if you have those columns instead of the date.
check PBIX file attach.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous ,
You also need to add the year to the filtering:
Measure =
VAR temp_table =
FILTER (
SUMMARIZE ( ALL ( 'Table' ); 'Table'[DAte]; 'Table'[Headcount] );
'Table'[Month] = SELECTEDVALUE ( 'Table'[Month] ) &&
'Table'[Year] = SELECTEDVALUE ( 'Table'[Year] )
)
RETURN
CALCULATE ( SUMX ( temp_table; 'Table'[Headcount] ) )
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCheck out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 38 | |
| 34 | |
| 21 | |
| 17 |
| User | Count |
|---|---|
| 66 | |
| 64 | |
| 31 | |
| 26 | |
| 26 |