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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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