Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hi,
I've got a report with a line chart, I wish add to my report a reference line on demand: in particular I'd like to have a filter which specifies some reference lines (max - min - mean, etc.) so that when user clicks one of these the relative reference line is displayed into the chart, is it possible?
Thanks in advance for any hint!
Solved! Go to Solution.
First create a table with a column with Max, Min , Average ...Use this to show a slicer to select the calculate formula of the line.
Next, create a measure to calc accord to slicer selected.
LineCalc =
IF (
VALUES ( Table1[Value] ) <> BLANK (),
IF (
HASONEVALUE ( Table2[LineType] ),
SWITCH (
VALUES ( Table2[LineType] ),
"Max", CALCULATE ( MAX ( Table1[Value] ), ALLSELECTED ( Table1 ) ),
"Min", CALCULATE ( MIN ( Table1[Value] ), ALLSELECTED ( Table1 ) ),
"Average", CALCULATE ( AVERAGE ( Table1[Value] ),ALLSELECTED ( Table1 ) )
)
),
BLANK ()
)
Vvelarde’s solution should be correct. You can also try to use the Min/Max/Average Line in analytics pane as below.
Best Regards,
Herbert
@v-haibl-msft unfortunatelly reference lines can't be shown/hidden on demand with this solution ![]()
First create a table with a column with Max, Min , Average ...Use this to show a slicer to select the calculate formula of the line.
Next, create a measure to calc accord to slicer selected.
LineCalc =
IF (
VALUES ( Table1[Value] ) <> BLANK (),
IF (
HASONEVALUE ( Table2[LineType] ),
SWITCH (
VALUES ( Table2[LineType] ),
"Max", CALCULATE ( MAX ( Table1[Value] ), ALLSELECTED ( Table1 ) ),
"Min", CALCULATE ( MIN ( Table1[Value] ), ALLSELECTED ( Table1 ) ),
"Average", CALCULATE ( AVERAGE ( Table1[Value] ),ALLSELECTED ( Table1 ) )
)
),
BLANK ()
)
Hi @Vvelarde,
thanks for your suggestion, only twoclarification:
How are related the slicer selection and the LineCalc measure? Does Table2[LineType] in switch statement represent the current selection in the slicer?
How can I add the LineCalc measure to my chart?
Here my chart without reference lines
I should add LineCalc measure to "Valori" field (Spot Series Values is the measure which draws the chart lines), but if I drag and drop LineCalc measure to "Valori" field it overwrites Spot Series Values ![]()
Thanks a lot!
How are related the slicer selection and the LineCalc measure? Does Table2[LineType] in switch statement represent the current selection in the slicer?
Yes. able2[LineType] represent the current selection in slicer. The slicer is the column of tha table with the line types.
How can I add the LineCalc measure to my chart?
If you have a legend this doesnt' work. When you use a legenf only Works with 1 line.
Not to my knowledge.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 38 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 34 | |
| 33 | |
| 30 |