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.
Hi, I would like to conditionally format my lines in the below line graph using year in DAX. The logic that I want is if year= 2019-2020, I would like the lines to be shown as dashed (--) instead of solid lines.
This is an example of my data
Year | Agency | Organization | Values |
2017 | agency1 | orga | 50 |
2018 | agency2 | orgb | 65 |
2019 | agency3 | orgc | 47 |
2020 | agency4 | orgd | 84 |
2021 | agency5 | orge | 55 |
2022 | agency6 | orgf | 67 |
I have done something similar with a bar chart - but I would like this dax code to be general; not column specific with the ability to be dynamic with filter input.
year2022 = IF('Data'[Year]=2022, 'Data'[Year] & " " & 'Data'[columnname],’Data'[columnname])
Solved! Go to Solution.
Hi @Anonymous ,
Maybe this is the result you want:
Please try following DAX:
Measure = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Year] IN {2019,2020}))
Put the [measure] and [Value] into Y-axis:
Change line type of measure into dashed:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Maybe this is the result you want:
Please try following DAX:
Measure = CALCULATE(SUM('Table'[Values]),FILTER('Table','Table'[Year] IN {2019,2020}))
Put the [measure] and [Value] into Y-axis:
Change line type of measure into dashed:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , Create a measure for 2019-2020
example
calculate(Sum(’Data'[columnname]), Filter('Data','Data'[Year] in {2019,2022}))
use this measure in line visual, enable marked, and under shape choose marker shape _ and make line width 0
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
99 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |