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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
rui_silva
Helper I
Helper I

Measure where dont sum duplicated values

Hi,

Im using tables with months and i need to calculate 1 data where some months the data dont change so i would to get a measure where it  will only sum if the values are different then the other month as for example:

 

Obs: In my data if in 2 months the nLossStudents are equals its means it hadnt changed the number of Students

Sample Data

 

Month           IDClass             NLossStudents

1                        1                           4       

2                        1                           4

3                        1                           1 

1                        2                           2

2                        2                           2

3                        2                           2

 

Expected Result:

Total LossStudents   : 6

 

 

Regards Rui Silva.

 

1 ACCEPTED SOLUTION

Hi,

Thanks for the help but i managed to make with this measure:

CALCULATE(SUM(Dados[Set]) - SUM(Dados[Atual]);FILTER(Meses;Meses[IDMes] = MES);FILTER(Dados; Dados[Set] - Dados[Atual] >= 0) ) 

The first filter its to filter the month , my months has a agregrated values so i could do this one and second one its to dont show values below zero .

Regards Rui Silva

View solution in original post

9 REPLIES 9
chotu27
Post Patron
Post Patron

@rui_silva If u want the sum of distinct value the it will be 7 Right why are you saying it has 6?

@chotu27 Yes its was my mistake sorry 

Try the Measure below 

Total = SUMX(DISTINCT(Data[Name]), FIRSTNONBLANK(Data[Value], 0))

 

 

Please give like if u like it 

Thanks for the assistance but the result giving its wrong maybe its my fault so im going to give some sample data from my source table where im getting the data,because i forgot the put the other column and i apologize for that . 

Source table:

IDMonth           IDClass     nStartStudents     nActualStudents 

1                            1                  25                           22

1                            2                  23                           21

2                            1                  25                           22

2                            2                  23                           21

3                            3                  25                           20

3                            3                  23                           21

 

The columns i need to calculate are the nActualStudents with nStartStudents as i dont want to calculate the duplicated ones 

Sorry for my mistake i didnt made the other column in the first post.

 

As i wanted to get a card where would say:

Total LossStudents = 6

 

Regards , Rui Silva

@rui_silvaHere again why the loss students 6 you wanted to get based on what?

@chotu27 The Loss Students are from nStartStudents - nActualStudents 

The nStartStudent are the number os students who started school year, and the nActualStudent is the number of the current students as pass of the same school year.

The objective of this measure its for a report for my enterprise and i need to get the total loss students but i cant sum the duplicated ones and i stated above all months that have same numbers are nActualStudents and nStartStudents are equal, and i only needed to calculate where nActualStudent are different from the other months. 

Regards , Rui Silva

Hi,

So im getting a problem where i need to calculate a measure where it will only sum the first value for nActualStudent and if nActualStudent its equal to other month  then it dont sum 

Sample data: 

IDMonth        IDClass              nStartStudents             nActualStudents

 1                       1                            30                                    29

 1                       2                            30                                    25

 2                       1                            30                                    29

 2                       2                            30                                    24

 

 

Regards , Rui Silva

 

Hi,

 

Try this measure

 

=CALCULATE(COUNTROWS(Data),FILTER(Data,Data[nStartStudents]-Data[nActualStudents]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

Thanks for the help but i managed to make with this measure:

CALCULATE(SUM(Dados[Set]) - SUM(Dados[Atual]);FILTER(Meses;Meses[IDMes] = MES);FILTER(Dados; Dados[Set] - Dados[Atual] >= 0) ) 

The first filter its to filter the month , my months has a agregrated values so i could do this one and second one its to dont show values below zero .

Regards Rui Silva

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors