March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
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
Id | insurance | charge | date |
100 | aetna | 100 | 1/15/2000 |
100 | aetna | 100 | 1/16/2000 |
100 | fidelis | 100 | 1/25/2000 |
101 | healthfirst | 200 | 2/1/2000 |
101 | healthfirst | 200 | 2/5/2000 |
102 | healthfirst | 3000 | 3/1/2000 |
102 | aetna | 300 | 3/1/2000 |
103 | aetna | 400 | 1/15/2000 |
103 | aetna | 400 | 1/18/2000 |
103 | aetna | 400 | 1/21/2000 |
103 | aetna | 400 | 2/15/2000 |
103 | aetna | 400 | 2/18/2000 |
103 | healthfirst | 400 | 2/21/2000 |
so if want to filter on a specific id i should get :
filter on 100 | |||
Id | insurance | charge | date |
100 | aetna | 100 | 1/15/2000 |
100 | aetna | 100 | 1/16/2000 |
Total | 100 |
filter on 103 | |||
103 | aetna | 400 | 1/15/2000 |
103 | aetna | 400 | 1/18/2000 |
103 | aetna | 400 | 1/21/2000 |
103 | aetna | 400 | 2/15/2000 |
103 | aetna | 400 | 2/18/2000 |
103 | healthfirst | 400 | 2/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
Id | insurance | charge | date |
100 | aetna | 100 | 1/15/2000 |
100 | aetna | 100 | 1/16/2000 |
100 | fidelis | 100 | 1/25/2000 |
101 | healthfirst | 200 | 2/1/2000 |
101 | healthfirst | 200 | 2/5/2000 |
102 | healthfirst | 3000 | 3/1/2000 |
102 | aetna | 300 | 3/1/2000 |
103 | aetna | 400 | 1/15/2000 |
103 | aetna | 400 | 1/18/2000 |
103 | aetna | 400 | 1/21/2000 |
103 | aetna | 400 | 2/15/2000 |
103 | aetna | 400 | 2/18/2000 |
103 | healthfirst | 400 | 2/21/2000 |
total | 1700 |
Can you please advise on the best way to go about this?? Thank you.
Solved! Go to 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.
Hi,
You may download my PBI file from here.
Hope this helps.
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] )
@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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |