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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
saanah2019
Helper II
Helper II

Show data but don't include in total calculations

Hey guys, I am at the end of my report but just have that one last hurdle. So I have a table Billing with fields Id, Insurance, Charge, Date

 

Idinsurancechargedate
100aetna1001/15/2000
100aetna1001/16/2000
100fidelis1001/25/2000
101healthfirst2002/1/2000
101healthfirst2002/5/2000
102healthfirst30003/1/2000
102aetna3003/1/2000
103aetna4001/15/2000
103aetna4001/18/2000
103aetna4001/21/2000
103aetna4002/15/2000
103aetna4002/18/2000
103healthfirst4002/21/2000

 

so if want to filter on a specific id i should get :

filter on 100  
Idinsurancechargedate
100aetna1001/15/2000
100aetna1001/16/2000
Total 100 

 

filter on 103  
103aetna4001/15/2000
103aetna4001/18/2000
103aetna4001/21/2000
103aetna4002/15/2000
103aetna4002/18/2000
103healthfirst4002/21/2000
total 800 

 

so basically this is an AR report and I want to show who I billed to and for how much but if the insurance name repeats, then obviously not to add all the occruences of one insurance  but rahter just add each distinct insurance name once. So i might just have one insurance name, or two and they might repeat like 6-8 times but I just want to subtotal each once. So my final subtotals should be  

 

Idinsurancechargedate
100aetna1001/15/2000
100aetna1001/16/2000
100fidelis1001/25/2000
101healthfirst2002/1/2000
101healthfirst2002/5/2000
102healthfirst30003/1/2000
102aetna3003/1/2000
103aetna4001/15/2000
103aetna4001/18/2000
103aetna4001/21/2000
103aetna4002/15/2000
103aetna4002/18/2000
103healthfirst4002/21/2000
total 1700 

 

Can you please advise on the best way to go about this?? Thank you. 

1 ACCEPTED SOLUTION

@saanah2019 here are couple of options

option 1, add measure

 

Total = 
SUMX(
    DISTINCT(SELECTCOLUMNS(Table2, "Id", Table2[Id], "Insurance", Table2[insurance] ) ), 
    CALCULATE(MAX( Table2[charge]) )
)   

Option 2, add unique column and then add measure

 

Unique Column = CONCATENATE(FORMAT(Table2[Id],"#") ,Table2[insurance])

Total = 
SUMX(
    VALUES( Table2[Unique Column] ), 
    CALCULATE(MAX( Table2[charge]) )
)   


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

This will give the correct totals based on unique ID and Insurance (not date)

Total of Unique = 
SUMX( 
    ADDCOLUMNS( 
        SUMMARIZE( Table1, Table1[ID],Table1[insurance]),
        "Total Charge",
        DIVIDE( [Total Charge], CALCULATE( COUNTROWS(Table1)))
    ),
    [Total Charge]
)

SUMX of unique.png

@Anonymous Hey thanks for the quick answer. I get an error, "A circular dependency was detected: Billing[Total of Unique]"

@saanah2019 here are couple of options

option 1, add measure

 

Total = 
SUMX(
    DISTINCT(SELECTCOLUMNS(Table2, "Id", Table2[Id], "Insurance", Table2[insurance] ) ), 
    CALCULATE(MAX( Table2[charge]) )
)   

Option 2, add unique column and then add measure

 

Unique Column = CONCATENATE(FORMAT(Table2[Id],"#") ,Table2[insurance])

Total = 
SUMX(
    VALUES( Table2[Unique Column] ), 
    CALCULATE(MAX( Table2[charge]) )
)   


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.