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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.