Forum Discussion
Creating a line chart with a dynamic total line
- 5 years ago
Anonymous solution attached.
edhans , not sure if not having that function I'm missing anything. Never had a need for it but it can be surely handy.
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Anonymous solution attached.
edhans , not sure if not having that function I'm missing anything. Never had a need for it but it can be surely handy.
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
parry2k Thank you so much for your help! Your solution didn't work exactly for my case, but it was very close. With some minor tweaks based on your answer, the issue I was having is resolved.
Create a measure of Total Sales
Total Sales = COUNT ( Table1[Region] )
Create a measure for Selected Sales to be used in Values of the line chart:
Selected Sales =
VAR _CurrentAxis = SELECTEDVALUE(Total[Region])
return
IF ( _CurrentAxis = "Total",
CALCULATE (
[Total Sales],
TREATAS ( ALLSELECTED ( Total[Region] ), Table1[Region] )
),
CALCULATE(
COUNT(Table1[Region]),
Table1[Region] = _CurrentAxis
)
)
EDIT: parry2k did have the correct solution, it was my mistake in copying it over to my own file. Please see their solution