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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

RE: Unique sum

Hi. Team. I need your help on this. I have to make a report before the end of the month. 

 

From this table:

 

Capture0001.PNG

 

 

 

To this outcome:

 

10437601-AAAA-4B70-B0D6-B7486F2FB822.jpeg

 

 

 

 

 

Hope this can help. TIA 

 

 

1 REPLY 1
DataInsights
Super User
Super User

@Anonymous,

 

Here's a solution based on my understanding of the requirements:

 

1. Orig Amount in the table visual is the sum of Orig Amount where Doc Code Sign = Y.

2. Audited Amt in the table visual is calculated as follows:

a. Count the number of rows for each Doc Code.

b. If count = 1, then sum Audited Amt.

c. If count > 1, then sum Audited Amt where Doc Code Sign <> Y.

 

Solution:

 

1. Create three measures. The second measure is used for calculation only; it is not displayed in the table visual.

Total Orig Amount = CALCULATE ( SUM ( Docs[Orig Amount] ), Docs[Doc Code Sign] = "Y" )

Audited Amount Calc = 
VAR vAuditAmt =
    SUM ( Docs[Audited Amt] )
VAR vCurDocCode =
    MAX ( Docs[Doc Code] )
VAR vCurDocCodeRows =
    FILTER ( ALL ( Docs ), Docs[Doc Code] = vCurDocCode )
VAR vCountDocCode =
    COUNTROWS ( vCurDocCodeRows )
VAR vRowsToSum =
    FILTER ( vCurDocCodeRows, Docs[Doc Code Sign] <> "Y" )
VAR vResult =
    IF ( vCountDocCode = 1, vAuditAmt, SUMX ( vRowsToSum, Docs[Audited Amt] ) )
RETURN
    vResult

Total Audited Amount = 
--this measure is necessary in order to properly calculate totals
VAR vDocCodeTable =
    ADDCOLUMNS (
        SUMMARIZE ( Docs, Docs[Doc Code] ),
        "AuditedAmountCalc", [Audited Amount Calc]
    )
VAR vResult =
    SUMX ( vDocCodeTable, [AuditedAmountCalc] )
RETURN
    vResult

 

2. Create a table visual and filter Doc Code Sign = Y.

 

DataInsights_0-1599420014227.png

 

DataInsights_1-1599420136670.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.