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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
samanthawongg
Frequent Visitor

Using a Measure as an Error Bar to Show a Dynamic Value

Hi, I have a pretty complicated plot and tables, but I will do my best to explain it. Essentially, I have a problem with using a custom measure for an error bar to show a dynamic value.

 

I have four tables: Cross Section Coordinates, Instrument Details, Sample Point, and VWP. There are five different cross sections that I have plotted using Chainage on the y-axis and Elevation on the x-axis from the Cross Section Coordinates table according to the legend values 'Static Plot'. I made a slicer titled Cross Section to display each of them.

 

Screenshot 2023-11-01 140109.png

 

Each cross section has different instruments. The instruments are plotted in the cross section plot as Tip Levels. When a cross section is selected in the Cross Section slicer, the Instrument slicer will automatically display the instruments available for that cross section. When an instrument is selected from that slicer, an error bar will be displayed, showing the range of the RLm value of that instrument. To select another cross section, you have to unselect all the instruments first.

 

Screenshot 2023-11-01 140210.png

Each instrument has RLm values that are stored in the VWP table as a column. I used error bars to display the maximum and minimum values of the RLm for each instrument on the same y-axis value as the Tip Levels. I created two measures as the fields for the upper bound and lower bound.

 

Screenshot 2023-11-01 140250.png

 

For the upper bound, I created the measure max_rlm:

 

max_rlm =
    if(SELECTEDVALUE('Cross Section Coordinates'[Chainage (m)]) == SELECTEDVALUE('Sample Point'[Cross section chainage]), max('VWP'[RLm]), 0)

 

For the lower bound, I created the measure min_rlm:

 

min_rlm =
    if(SELECTEDVALUE('Cross Section Coordinates'[Chainage (m)]) == SELECTEDVALUE('Sample Point'[Cross section chainage]), min('VWP'[RLm]), 0)

 

These measures compare the value of the cross section chainage of the selected instrument in the Sample Point table to the cross section chainage values in the Cross Section Coordinates table. If they are the same, the respective maximum/minimum values will be shown for that instrument, otherwise nothing will be shown. There is an established Many-to-Many relationship between the cross section column in the Cross Section Coordinates table and the cross section column in the Sample Point table.

 

Currently, when an instrument is chosen, only 1 pair of upper and lower bound can be shown on a cross section. When 2 or more instruments are selected, the error bars no longer show up. I want to display all of the upper and lower bounds for all the instruments for every cross section. How do I modify max_rlm and min_rlm to achieve this?

 

Many Thanks,
Samantha

3 REPLIES 3
samanthawongg
Frequent Visitor

Hi, thank you for your reply.

 

In that case, is there a DAX function that can take account more than one item to replace SELECTEDVALUE?

 

Thanks

Depends on your situation, for example VALUES ()

lbendlin
Super User
Super User

SELECTEDVALUE won't work if you have less than or more than one item selected.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors