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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

2nd Calculated Column Formula

I have 3 Raw Data Columns (Date, Group, Number) and 1 Calculated Column (80). I'm trying to make a 2nd Calculated Column where the denominator is the sum of the first calculated column for each row of the same date:

DateGroupNumber80 
5/9/2019Blue0.50.0062540.00%
5/9/2019Green0.250.00312520.00%
5/9/2019Blue0.50.0062540.00%
5/10/2019Red0.150.00187515.79%
5/10/2019Red0.30.0037531.58%
5/10/2019Yellow0.50.0062552.63%

So the denominator for the first three rows (5/9/19) would be 0.015625

     the denominator for the second three rows (5/10/19) would be 0.011875

The 2nd calculated column would add to 100% for all the rows of the same date. 

Can anyone advise on the correct formula to do this in PowerBI?

*ETA: right now I am using: Divide(Table[80],sum(Table[80]),0) but not sure if I'm missing something..

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi@Anonymous ,

 

Try the following replace Table with your tablename

 

Percents =
VAR _total80 =
    CALCULATE (
        SUM ( 'Table'[80] ),
        FILTER ( 'Table', [Date] = EARLIER ( 'Table'[Date] ) )
    )
RETURN
    DIVIDE ( [80], _total80 )

Cheers

 

CheenuSing

View solution in original post

Anonymous
Not applicable

Hi @Anonymous 

 

 

_total80 is a temproary variable created to compute the totals of column named 80 in your dataset, for each date.

     FILTER ( 'Table', [Date] = EARLIER ( 'Table'[Date] ) )  checks if the current date is same as earlier row  date and groups them together.

 

Cheers

 

CheenuSing

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi@Anonymous ,

 

Try the following replace Table with your tablename

 

Percents =
VAR _total80 =
    CALCULATE (
        SUM ( 'Table'[80] ),
        FILTER ( 'Table', [Date] = EARLIER ( 'Table'[Date] ) )
    )
RETURN
    DIVIDE ( [80], _total80 )

Cheers

 

CheenuSing

Anonymous
Not applicable

Hello, 

Can you break down what this is doing?

It works for the test data I posted, but not for my real/master file. 

 

VAR _total80 =
    CALCULATE (
        SUM ( 'Table'[80] ),
        FILTER ( 'Table', [Date] = EARLIER ( 'Table'[Date] ) )
    )
RETURN
    DIVIDE ( [80], _total80 )

 

What is _total80?

If I filter by [Date] = EARLIER ('Table'[Date]) what is that doing?

 

TYIA

Anonymous
Not applicable

Hi @Anonymous 

 

 

_total80 is a temproary variable created to compute the totals of column named 80 in your dataset, for each date.

     FILTER ( 'Table', [Date] = EARLIER ( 'Table'[Date] ) )  checks if the current date is same as earlier row  date and groups them together.

 

Cheers

 

CheenuSing

 

 

Anonymous
Not applicable

Thank you! very much appreciate the additional explanation.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.