Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello!
I am trying to aggregate and count patients based on their claims spend.
Here is a sample table:
patient_id Medical Rx
ABC123 $50,000 $10,000
DEF123 $25,000 $5,000
HIJ123 $10,000 $1,000
I then created a Total Spend measure: Total Spend: calculate(sum(Patient[medical)+calculate(sum(Patient[Rx). This yields a result for Patient ABC123 of $60,000, DEF123 $30,000, and HIJ123 $11,000.
I'm good up to this point.
Lastly, I created a table that is being used as a filter to give me claim spend ranges:
claim_range
$10,000
$20,000
$30,000
$40,000
$50,000
$60,000
$70,000
$80,000
$90,000
$100,000
Lastly, I created a measure based on the selected claim_ranges above: Claim Range: calculate(average(Claim[claim_range])
This is used as a filter to adjust the formulas below.
#1: First formula seems to work just fine
Solved! Go to Solution.
Hi @novotnajk ,
Check the formulas.
Claim Range = calculate(average(Claim[claim_range]))
Claim Range 50% = [Claim Range]*.50
High Cost Patients = CALCULATE(DISTINCTCOUNT(Patient[patient_id]),FILTER(Patient,Patient[Total Spend]>=Claim[Claim Range]))
High Cost Patients 50% = CALCULATE(DISTINCTCOUNT(Patient[patient_id]),FILTER(Patient,Patient[Total Spend]>=Claim[Claim Range 50%]&&Patient[Total Spend]<Claim[Claim Range]))
Best Regards,
Jay
Hi @novotnajk ,
Check the formulas.
Claim Range = calculate(average(Claim[claim_range]))
Claim Range 50% = [Claim Range]*.50
High Cost Patients = CALCULATE(DISTINCTCOUNT(Patient[patient_id]),FILTER(Patient,Patient[Total Spend]>=Claim[Claim Range]))
High Cost Patients 50% = CALCULATE(DISTINCTCOUNT(Patient[patient_id]),FILTER(Patient,Patient[Total Spend]>=Claim[Claim Range 50%]&&Patient[Total Spend]<Claim[Claim Range]))
Best Regards,
Jay
Hi Ashish,
I was hoping to avoid another filter (proportion). If there a way to build the proportion you've highlighted above into a measure?
Hi,
The input of 50% or 40% has to be a user input - that's why i built that table manually.
Sorry, meant patients, not employees.
Hi,
You may download my PBI file from here. The table on the right will show you the customers who spent between 30,000 and 60,000. From the third table, if you wish, you may remove the Patient_ID field.
Hope this helps.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |