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
Achartuni
Helper I
Helper I

I'd like to get the total value taking into account 2 or more columns

Hello

 

Given the data below I'd like to et the total of "valor" grouped by year and university. 

 

Say if I have this sample of data, the desired result is stored in the D column

 

A  |  B  |  C  | D

2  |  X  |   5  | 5   

3  |  X  |   5  | 5

2  |  Y  |   5  | 10

2  |  Y  |   5  | 10

Annotation 2019-08-16 151335.png

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Achartuni 

 

Try following

 

=Calculate(sum(TableName[ColumnC]),allexcept(TableName,TableName[ColumnA],TableName[ColumnB]))

Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@Achartuni 

 

Try following

 

=Calculate(sum(TableName[ColumnC]),allexcept(TableName,TableName[ColumnA],TableName[ColumnB]))

Regards
Zubair

Please try my custom visuals

Thanks! It solves the issue I was having with my data.

 

Is there any other way to do it? I am starting with Power BI and I'd like to know if there's any othe way to achieve this, thanks in advance!

 

 

@Achartuni 

 

Another way as a calculated column could be

 

=
CALCULATE (
    SUM ( TableName[ColumnC] ),
    FILTER (
        TableName,
        TableName[ColumnA] = EARLIER ( TableName[ColumnA] )
            && TableName[ColumnB] = EARLIER ( TableName[ColumnB] )
    )
)

Regards
Zubair

Please try my custom visuals

Thanks! Could you explain the EARLIER? I don't seem to get its functionality quite right

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.