Forum Discussion

JustinLowmaster's avatar
JustinLowmaster
Frequent Visitor
7 years ago
Solved

Using data from one row for math applies to every row

I have a list of rows with XYZ coordinantes. I want to select one row (with a slicer?) and apply math using the XYZ of the selected row with every other row, limiting the visible rows to those that a...
  • Cmcmahan's avatar
    Cmcmahan
    7 years ago

    Ah, you have kind of a weird use case. Aggregating the results with COUNT is easy to display. Retaining all of the values to display is harder. If you're trying to return and display all the data points that are within 20 distance of a user-settable value, I would suggest using a What If Parameter.

     

    Create separate What If Parameters for X, Y, & Z.  It will create a table and a slicer for each of them. Do NOT relate these tables to your fact table. And then you can use the measures the wizard creates (they should look like [X Value] if you named it "X") to create your distance measure instead of the vars.  

     

    Here's the measure I would create:

    Distance From Sliced Point = 
    SQRT(
    	([X Value] - SELECTEDVALUE('FACT - System Expansion'[X Coord])) ^ 2
    	+ ([Y Value] - SELECTEDVALUE('FACT - System Expansion'[Y Coord])) ^ 2
    	+ ([Z Value] - SELECTEDVALUE('FACT - System Expansion'[Z Coord])) ^ 2 
    )

     Then you would take your table visual, add all the values you want to it, along with this measure.  Then you can filter the visual where [Distance From Sliced Point] is less than 20.  Slide your new parameter slicers to pick coordinates.

     

    This has the added benefit of being able to pick any point in the coordinate plane, not just points where you have associated data.