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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to make a measure interact with a slicer ?

I'm still relatively to DAX so pardon me if it's an obvious query.

 

Basically, I'm working with Google BigQuery's USA names dataset, that lists every birth since 1910 along with the name, gender and state of the child.

 

I downloaded the Text Filter tool from the Marketplace, so that I could write in a name that would serve as a filter for a heatmap, which would show me the prevalence of that name in each state (as in, what percentage of Texas births were named "John", etc for every state. 

 

I'm confused as to how to pass the name I'm filtering the data with to the measure (as in, I want it to be something like 

 

 

 

percentage =
 divide( 
  calculate (
    sum(nofbirths);filter(all(usanames);usanames[name]=*slicer text*));
  calculate (
    sum(nofbirths)))

 

 

 

and I'm guessing it'd only sum the births over each state instead of over the whole table since the measure would apply to each state only.

 

Do you have any idea on how I can achieve this ?

 

Update: nevermind, Zineb did the job better than the internet could. ^^

 

pourcentage = divide(CALCULATE(sum(usa_1910_current[number]);FILTER(all(usa_1910_current);usa_1910_current[name]=SELECTEDVALUE(usa_1910_current[name]) &&usa_1910_current[state]=SELECTEDVALUE(usa_1910_current[state])));CALCULATE(sum(usa_1910_current[number]);FILTER(all(usa_1910_current);usa_1910_current[state]=SELECTEDVALUE(usa_1910_current[state]))))

 

map filtered.png 

1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Try using the following DAX:

 

percentage = divide(
                                  calculate (
                                                  sum(nofbirths);filter(all(usanames);usanames[name]=SELECTEDVALUE(usanames[name]))

                                                 );
                                  calculate (
                                                   sum(nofbirths)

                                                 )

                               )

 

If the solution is helpful please give Kudos and if it resolves kindly mark this as a solution! 🙂

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

1 REPLY 1
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Try using the following DAX:

 

percentage = divide(
                                  calculate (
                                                  sum(nofbirths);filter(all(usanames);usanames[name]=SELECTEDVALUE(usanames[name]))

                                                 );
                                  calculate (
                                                   sum(nofbirths)

                                                 )

                               )

 

If the solution is helpful please give Kudos and if it resolves kindly mark this as a solution! 🙂

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors