Hello @Preston,
Below is the formula provided to achieve the result i.e. “Freight + Dollars = Total Freight” -
Total Freight - Consolidated =
VAR Freight =
SUMX(
SUMMARIZE(
AR_InvoiceHistoryHeader ,
AR_Customer[CustomerNo] ,
AR_InvoiceHistoryHeader[FreightAmt] ) ,
AR_InvoiceHistoryHeader[FreightAmt]
)
VAR Dollars =
IF( ISBLANK( SUM( AR_InvoiceHistoryHeader[FreightAmt] ) ) ,
BLANK() ,
CALCULATE( SUM( AR_InvoiceHistoryHeader[Dollars] ) ,
ALLEXCEPT(
AR_InvoiceHistoryHeader ,
AR_InvoiceHistoryHeader[Key]
)
)
)
RETURN
Freight + Dollars
Now, once you create this measure you’ll get the correct results for individual line items but the “Grand Total” will be off by a long way. Below is the screenshot of the result provided for the reference -
So if you see individual line items are correct but grand total is not correct. Ideally, it should’ve been $20,703.29 i.e. Dollars + Freight (20,475 + 228).
So now, to achieve the correct grand total write a small formula. Below is the formula provided for the reference -
Total Freight - Cons. Total =
SUMX(
SUMMARIZE(
AR_InvoiceHistoryHeader ,
AR_Customer[CustomerNo] ,
AR_InvoiceHistoryHeader[Key] ,
"@Totals" ,
[Total Freight - Consolidated] ) ,
[@Totals] )
Since you wanted to show the results in the form of “Card Visual” that’s why we had to write the formula since card visual doesn’t have any context by default. @BrianJ had recently created a video based on this topic which addresses this issue in depth I’m providing a link below of that video. Otherwise there was a trick to fix the incorrect total without writing the formula. Just go to the FILTER PANE and under the “Dollars” field select the option of “is not blank” and you’ll see the totals getting fixed but this trick is not applicable for card visuals. Below is the screenshot provided for the reference -
I’m also attaching the working of the PBIX file for the reference.
Hoping you find this useful and meets your requirements that you’ve been looking for.
Thanks and Warm Regards,
Harsh
SalesDollarsByProduct - Harsh v2.pbix (1.7 MB)