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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
PatrickdeJongh
New Member

SUMIF equivalent to creat new column within one table

I'm trying to calculate a new column, Weighting 2 that sums the weighting for each CourseModule where AssignmentDueDate is less than or equal to the current value set by a slicer. 
I made a measure called Success Rate Date to hold the slicer value of the slicer. 
All the data is in one table in a Database called Coursedocument.


I need the Weighting 2 to be dynamic as the user can set the slicer to adjust AssignmentDueDate and thus the Success Rate Date.  I will use the Weighting 2 values to do other calculations. Weighting 2 will be 100 or less for each row.

I have tried a few variances of the Dax functions:

Weighting 2 =

SUMMARIZE(Coursedocument, Coursedocument[CourseModule],"Weighting 2", CALCULATE(SUM(Coursedocument[Weighting]), FILTER(

            Coursedocument,

            Coursedocument[AssignmentDueDate] <= Coursedocument[Success Rate Date]

        )))

Weighting 2 =

SUMMARIZE(Coursedocument, Coursedocument[CourseModule], "Weighting 2", CALCULATE(SUM(Coursedocument[weighting]),

          Coursedocument[AssignmentDueDate] <= Coursedocument[Success Rate Date]

        ))

Example data (from Database)

A

B

C

D

E

Id

CourseModule

Weighting

AssignmentDueDate

Weighting 2

15914

3495

100

28/02/2023

100

18461

3986

100

31/05/2023

100

18538

4002

7

31/03/2023

22

18539

4002

15

31/03/2023

22

18544

4004

15

31/01/2023

100

18545

4004

20

31/01/2023

100

18546

4004

10

28/02/2023

100

18547

4004

15

28/02/2023

100

18548

4004

20

28/02/2023

100

18549

4004

20

28/02/2023

100

19011

4186

15

31/01/2023

25

19012

4186

10

31/01/2023

25

19019

4187

12

28/02/2023

56

19020

4187

7

28/02/2023

56

19021

4187

15

31/03/2023

56

19022

4187

7

31/07/2023

56

19023

4187

15

31/07/2023

56

In Excel I would simply use Weighting 2  =SUMIF(B:B,B4,C:C) and drag the formula down. 
How can I get this right as a Column added to my table? 

1 REPLY 1
GeraldGEmerick
Resolver II
Resolver II

@PatrickdeJongh You cannot create a column since calculated columns are not dynamic. However, you can create a measure like the following:

Measure = 
    VAR _CourseModule = MAX( 'Table'[CourseModule] )
    VAR _Date = MAXX( ALLSELECTED( 'Table'[AssignmentDueDate] ), [AssignmentDueDate] )
    VAR _Return = CALCULATE( SUM( 'Table'[Weighting] ), FILTER( ALL( 'Table' ), [AssignmentDueDate] <= _Date && [CourseModule] = _CourseModule ) )
RETURN
    _Return

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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