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
Anonymous
Not applicable

How to make an interactive formula with a filter

I am trying to make my cards be filtered and calculated using my filters... but they don't seem to be working.  

 

I have my formula - and it takes the total revenue, and divides by the count of how many patients there are... but I want it to filter with each practice.  

I want to click on one practice, and the average patient revenue is connected to that (that practices revenue / that practices count of patients)

 

Thanks in advance,

 

AvgRevenue Per Patient = [Revenue] / CALCULATE(DISTINCTCOUNT('public view_patients'[patient_key]), FILTER('public view_practices', 'public view_practices'[name] = [SelectedPractice]))
 
SelectedPractice = SELECTEDVALUE('public view_practices'[name], "All")

nattiej101_0-1618933222750.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

AvgRevenue Per Patient = [Revenue] / CALCULATE(DISTINCTCOUNT('public view_patients'[patient_key]), FILTER('public view_practices', 'public view_practices'[name] in ('public view_practices'[name])))

 

I think even this should work

 

AvgRevenue Per Patient = [Revenue] / CALCULATE(DISTINCTCOUNT('public view_patients'[patient_key]))

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try like

AvgRevenue Per Patient = [Revenue] / CALCULATE(DISTINCTCOUNT('public view_patients'[patient_key]), FILTER('public view_practices', 'public view_practices'[name] in ('public view_practices'[name])))

 

I think even this should work

 

AvgRevenue Per Patient = [Revenue] / CALCULATE(DISTINCTCOUNT('public view_patients'[patient_key]))

 

Anonymous
Not applicable

Neither of those worked..... 

 

the first one gave me an error about the in statement, and the other one is what I had at once, but doesn't filter correctly.  I am suppose to get values like in their 30-40s but I'm getting numbers under 15

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.