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.
Hi,
I have a formula that is adaptive whenever the user select a country on the page or if no country selected (which is if the user want to see a zone).
To do this I simply check the filter like this :
IF(HASONEFILTER(COUNTRY[COUNTRY]);...;...)
This works well when I display my measure in a graph (bridge in this example).
However this does not work when I display it in a grid where I also have the countries on rows. Indeed this would automatically compute the formula on one country and not by zone.
How can I check the user filter only which is the selection made on the segment and ignore the row filter ?
Thanks for your help
hi, @Anonymous
This involves the row context in DAX calculation.
https://www.sqlbi.com/articles/row-context-and-filter-context-in-dax/
For your case, just try this:
If COUNTRY table is dim table, use [COUNTRY] field from data table in a gird, do not use [COUNTRY] field from COUNTRY table.
If COUNTRY table is not dim table, create a dim table, then create a relationship with Country table and use [COUNTRY] field from dim table in a gird.
Here is a simple pbix file, please try it.
Best Regards,
Lin
COUNTRY is indeed a dim table but [COUNTRY] is not the key. It's a different hierarchy from the key that is linked to my data table. Therefore I cannot display the field from my data table.
hi, @Anonymous
Could you share a simple sample pbix file with your expected output?
Best Regards,
Lin
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |