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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
raphazzz
Helper I
Helper I

How to fix a Non-addictive calculation?

Hi there,

I have a matrix showing the wrong results on the total (not surprising, right?), but the rows are correct. I exported the data to Excel to double-check.

There is no filtering on the page but in the matrix instead of summing the rows individually, it actually uses the results of each column to return the total.

I already tried FILTERS and ALL/ALLEXPECT parameters but could not figure it out.

raphazzz_0-1687475583911.png

This is the formula of Column B, which does a distinct count of all days with sales by location in the current month excluding Sundays.

 

Selling Days =

CALCULATE (

AVERAGEX (

SalesReport,

DISTINCTCOUNT ( SalesReport[Date Sold] )

),

WEEKDAY (

SalesReport[Date Sold],

2

) <> 1

)

//Excluding Sundays

 

 

This is the formula of Column C, which returns the expected days of sales for the current month.

 

 

Expected Selling Days = CALCULATE (

AVERAGE ( 'Sales Projection 2023'[knocking_days] ),

'Sales Projection 2023'[knocking_days]

<> BLANK (),

'Sales Projection 2023'[knocking_days] <> 0

)

//Excluding Zeros and/or blanks

 

 

This is the formula of Columb D, which sums the sales excluding cancellations:

 

 

Actual($) = CALCULATE (

SUMX (

SalesReport,

SalesReport[Initial Service Price]

),

SalesReport[Status]

IN {

"Pending",

"Serviced",

"Not Serviced"

}

)

 

 

 

This is the formula of Columb E, which divides the result of the actual sales by selling days (column B) and multiplies by expected selling days (column C), to calculate the projected Sales for the Month end.

 

 

Expected ($) = 

VAR A = [zAct. IR]

VAR B = DIVIDE ( [zProjected Service Days], [zEstimated IR2] )



RETURN

A*B

 

 




3 REPLIES 3
raphazzz
Helper I
Helper I

up

amitchandak
Super User
Super User

@raphazzz , Multiplication needs to be done at the row level or virtual table level. Assume you have a location dimension. Change calc in one of the way

 

Expected ($) =

VAR A = [zAct. IR]

VAR B = DIVIDE ( [zProjected Service Days], [zEstimated IR2] )

RETURN

Sumx(values(Location[Location]), calculate( A*B
))


Or


Expected ($) =

VAR A = [zAct. IR]

VAR B = DIVIDE ( [zProjected Service Days], [zEstimated IR2] )

 

RETURN

Sumx(values(Location[Location]), ( A*B
))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

It still returning the wrong total. I tried the approach that you suggested and instead of returning the
$43,123,598, which is the sum of all rows, it is returning $1,588,799,149

raphazzz_0-1688012697222.png

The total contract value sums all the sales amount (contract value) from a sales table (each row in this table is one sale) and I exclude canceled and not active sales. 


SD refers to how many days in the month we had sales

KD refers to how many days we expect to have sales

Example: Branch A had $100,000 in sales in june 20th and we expecting 30 days of sales in june.

$100,000 / 20 * 30 = $150,000

Branch B had $100,000 in sales in june 20th but only had sales in 19 out of the 20 days that has gone so far but it was projected to sell 29 days in june (because they missed one day).

$100,000/19 * 29 = $152,632

Basically PBi total assumes the sum os sales $200,000 and divide by 20 selling days and multiply by 30 and returns $300,000 instead of $302,632

raphazzz_1-1688013479267.png



 

zEstimate IRCV2 = 
    VAR TotalContractValue =
CALCULATE (
    SUM ( SalesReport[Contract Value] ),
    FILTER (
        SalesReport,
        (SalesReport[Status] <> "Canceled"
        && SalesReport[Active] = "YES")
    )
)
    VAR SD = [SD]

    VAR KD = [KD] 

    RETURN
    
   SUMX(VALUES(Entity[Branch]),CALCULATE(DIVIDE(TotalContractValue,SD)*KD))

 

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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