The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have three tables: `origin`, `destination`, and `all_local` table which has the geo data points for all the the (unique) locations. Based on the user's selection, I'd like to visualize these data points on the Map visual. As shown in the following graph.
I've set up two single select slicers for the origin and destination table. If the user selects both origin and destination, the data point for these two locations should be filtered from the `all_local` table and display the datapoint for these two locations on the map visual. Otherwise, all the locations in the `all_local` table should be displayed on the map.
I tried a couple of methods including the following code, but with no luck. I'd appreciate any suggestions.
filtered_table = (
var org = SELECTEDVALUE('origin'[name])
var dest = SELECTEDVALUE('destination'[name])
return Filter(all_local, all_local[name] = org || all_local[name] = dest)
)
Dummy Data
Table: Origin
Columns: name, val
Brethren | 1 |
White Pine | 1 |
Westphalia | 1 |
Holt | 1 |
Frontier | 1 |
Bay Shore | 1 |
Cutlerville | 1 |
Zilwaukee | 1 |
Eckerman | 1 |
Old Bridge | 1 |
Somers Point | 1 |
Franklinville | 1 |
Allamuchy | 1 |
Laurel Springs | 1 |
West Belmar | 1 |
Pomona | 1 |
Table: Destination
Columns: name, value
Avon-by-the-Sea | 2 |
Columbia | 2 |
Singac | 2 |
Ralston | 2 |
Bayonne | 2 |
Ridgefield Park | 2 |
Towaco | 2 |
Sewell | 2 |
Navesink | 2 |
Lake Pine | 2 |
Mercury | 2 |
Dunphy | 2 |
Spanish Springs | 2 |
Schurz | 2 |
Round Mountain | 2 |
Fernley | 2 |
Table: all_local
Columns: name,State,Lat,Long,Flu cases reported
Brethren | Michigan | 44.2989 | -86.0185 | 184.7 |
White Pine | Michigan | 46.7402 | -89.5812 | 235.1 |
Westphalia | Michigan | 42.9303 | -84.798 | 328 |
Holt | Michigan | 42.6416 | -84.5307 | 1086 |
Frontier | Michigan | 41.7817 | -84.6047 | 101.6 |
Bay Shore | Michigan | 45.3609 | -85.1117 | 163.9 |
Cutlerville | Michigan | 42.8406 | -85.6739 | 1246.4 |
Zilwaukee | Michigan | 43.4809 | -83.9223 | 271 |
Eckerman | Michigan | 46.3653 | -85.0354 | 29.7 |
Old Bridge | New Jersey | 40.3946 | -74.3323 | 785.9 |
Somers Point | New Jersey | 39.3167 | -74.6066 | 1008 |
Franklinville | New Jersey | 39.6182 | -75.0757 | 322.8 |
Allamuchy | New Jersey | 40.9222 | -74.8116 | 134.2 |
Laurel Springs | New Jersey | 39.8213 | -75.0053 | 1613 |
West Belmar | New Jersey | 40.1707 | -74.0376 | 2403.7 |
Pomona | New Jersey | 39.4687 | -74.5501 | 198.1 |
Avon-by-the-Sea | New Jersey | 40.1914 | -74.0162 | 1627 |
Columbia | New Jersey | 40.926 | -75.0945 | 360.9 |
Singac | New Jersey | 40.8849 | -74.243 | 2523.9 |
Ralston | New Jersey | 40.7712 | -74.6252 | 164.9 |
Bayonne | New Jersey | 40.6659 | -74.1141 | 4456 |
Ridgefield Park | New Jersey | 40.8543 | -74.0201 | 2979 |
Towaco | New Jersey | 40.922 | -74.3454 | 582.8 |
Sewell | New Jersey | 39.7665 | -75.1443 | 968.2 |
Navesink | New Jersey | 40.4021 | -74.0387 | 208.5 |
Lake Pine | New Jersey | 39.8659 | -74.8493 | 900 |
Mercury | Nevada | 36.6605 | -115.9945 | 0 |
Dunphy | Nevada | 40.7088 | -116.5301 | 0 |
Spanish Springs | Nevada | 39.6567 | -119.6695 | 445 |
Schurz | Nevada | 38.9366 | -118.7925 | 19.5 |
Round Mountain | Nevada | 38.711 | -117.0676 | 17.8 |
Fernley | Nevada | 39.5612 | -119.1925 | 62 |
HI @Rza_o,
Did these tables and filter link to the same geo field? If that is the case, current power bi will use AND logic to link different filter effect. So if you select item on different filters, they will be filtering records which match all the filter items.
If these filter conditions are contradictory, it will affect the visualization and no data displayed because not existed records match all conditions at the same time.
For this scenario, you may need to break the relationship and directly extract these selections to use Dax expression to calculations.
Regards,
Xiaoxin Sheng
I updated my post. It didn't allow me to upload the files so I had to use html tables 😕
Thank you
User | Count |
---|---|
77 | |
75 | |
36 | |
31 | |
29 |
User | Count |
---|---|
93 | |
81 | |
57 | |
48 | |
48 |