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

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.

Reply
Lorraine
Helper I
Helper I

Dynamic Reference Line Trouble

Hi!

 

This is my first post, I really hope you can help me. 

 

On an analysis we're working on (Primary and Middle School Analysis) , we've created a line and stacked column of performance level with score values. In that visual we have grades 3, 4, 5, 6, 7, and 8. There's a slicer set up to only display the selected grade, and that's working perfectly.

 

I think the way to do this is to create a measure based on the grade field and place it in the line values of the chart. We want to add a proficiency line, but that line will be different for each grade. So ideally, when 'Grade 4' is selected in the slicer, their unique line value appears. We tried to create a new measure for the line value. The formula entered is below, but this is not working : 
"ProfLine = IF(ISFILTERED(Student[Grade__c]),LOOKUPVALUE(3,Student[Grade__c],Student[3],66)))"

 

These are the values for each grade: 

Grade 3: 66

Grade 4: 70

Grade 5: 63

Grade 6: 58

Grade 7: 56

Grade 8: 62

 

Is there a way to set up different value lines that are only displayed when the specific grade is selected?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Hi @Lorraine,

Please create a measure using the formula below. You can add more choice in the SWITCH function, for example, ELA 5, ELA 6, ELA 7 and so on.


line =
IF (
    ISFILTERED ( Table[ClassGrades] ),
    SWITCH ( SELECTEDVALUE ( Table[ClassGrades] ), "ELA 3", 58, "ELA 4", 61, 100 ),
    0
)



Then add the measure in line chart field, you will get expected result.

 

Best Regards,
Angelia

View solution in original post

3 REPLIES 3
v-huizhn-msft
Employee
Employee

Hi @Lorraine,

I create a  a line and stacked column as follows.

1.PNG


As I tested, when you create a slicer to filter the  a line and stacked column visual, when a value is selected in slicer, the line become a dot and there only one bar, what result do you want to get? Could you please share more details?

2.PNG

 

Best Regards,
Angelia

Hi @v-huizhn-msft,

 

This is what my chart originially looks like:

Screenshot (1).png

 

For ELA 3 I want to add a line value of 58, so I added a measure to equal 58. When using the slicer to select ELA 3, I have this:

Screenshot (3).png

That's how I want the data to be displayed, so that's great. The problem is when I deselect ELA 3, and go back to viewing all grades at once, this is the visual:

Screenshot (4).png

 

The issue is that I only want that line value to be shown when I select Grade 3 in the slicer. I want each grade to have a different line measure, but for it to show only when that grade is selected in the slicer. For example, the line value for grade 4 is 61. So when I select grade 4, I want the line value to be 61, not 58. I want the line values dynamic in the sense that the lines will change when I change the grade selected in the slicer. Please let me know if this is possible and how I can set it up!

 

Thanks, 

Lorraine

Hi @Lorraine,

Please create a measure using the formula below. You can add more choice in the SWITCH function, for example, ELA 5, ELA 6, ELA 7 and so on.


line =
IF (
    ISFILTERED ( Table[ClassGrades] ),
    SWITCH ( SELECTEDVALUE ( Table[ClassGrades] ), "ELA 3", 58, "ELA 4", 61, 100 ),
    0
)



Then add the measure in line chart field, you will get expected result.

 

Best Regards,
Angelia

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.