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.
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]))))
Solved! Go to Solution.
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
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
80 | |
63 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |