Forum Discussion
Constant y-axis value based on field value?
- 2 years ago
Hi MojoGene
There is no option to work with your sample data file because all data is about the same point in time + the values are not equal to the values on the pictures....
in general, you can add constant lines in this way :
After creating a line graph :and then format it.
Maximum line in the same way.These lines are dynamic:
Pbix is attached.
More guides about working with constant lines :
https://www.easytweaks.com/add-horizontal-line-power-bi-chart-visual/
https://blogs.perficient.com/2023/05/03/analytics-pane-in-power-bi-part1/
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- 2 years ago
Hi MojoGene
Now your sample has just one test ....if I understand correctly the table that you attached.So I used again my file.
You can create customized constants.
Ob the first step you need to create dimensions for date and lab tests with unique values.These dimensions should be used as slicers and categories on the graph
Then you can create measures for constants :
sum_for_Max = if(SELECTEDVALUE('location_T'[Location],0)=0,"",CALCULATE(max(space_missions[Price]),ALLSELECTED('calendar'[Date])))sum_for_min = if(SELECTEDVALUE('location_T'[Location],0)=0,"",CALCULATE(min(space_missions[Price]),ALLSELECTED('calendar'[Date])))Result :
PBIX is attached
More information about dimension tables :
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- 2 years ago
Hi MojoGene
You can work with every time granularity that you want, just create a time dimension table.
https://www.youtube.com/watch?v=-q7v56p192M&t=15sIf this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Thanks again for the reply. It occurred to me (duh!) as I was reading your reply that I uploaded data filtered for multiple tests at only one date/time. I should have filtered the data for a single test over multiple date/times as shown in the image. The constant lines I have in mind would only work with one lab test selected. With two or more selected the reference lines would clutter and confuse the chart.
So, I would need to display the high/low reference values with a measure that showed the lines when only one test was selected.
Hi MojoGene
Now your sample has just one test ....if I understand correctly the table that you attached.
So I used again my file.
You can create customized constants.
Ob the first step you need to create dimensions for date and lab tests with unique values.
These dimensions should be used as slicers and categories on the graph
Then you can create measures for constants :
Result :
PBIX is attached
More information about dimension tables :
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- MojoGene2 years agoPost Patron
Thanks again for your extraordinary effort. I can follow your explanation very well, but this will not work for my needs because the time dimension on the calendar (days) forces the lab results to be summarized for each day. The test results are most meaningful when shown as individual, non-aggregated values. The test results might provide some useful information if aggregated as AVE, MIN or MAX, but a SUM is meaningless for this context.
Would I be able to get HOURS on the x-axis?
- Ritaf19832 years agoSuper User
Hi MojoGene
You can work with every time granularity that you want, just create a time dimension table.
https://www.youtube.com/watch?v=-q7v56p192M&t=15sIf this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- MojoGene2 years agoPost Patron
I feel like I am very close here, but I can't seem to get Hours granularity on the Date hierarchy.