Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I have a line chart, my users choose an area from a slicer. The line chart then shows the population growth for this area.
What I want is to show a second line, an other area (Göteborg) to compare to the chosen one. So I want one line that the user choose and one that is always there. But it doesnt seem to be possible to preselect a locked value?
Hi @jeseng ,
According to your description, I create this data:
Here are the steps you can follow:
1. Create measure.
Locked in (Gothenburg) development:
Gothenburg region all =
SUMX(FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])),'Table'[people])User selected:
User chooise =
var _select=SELECTEDVALUE('Slicer'[Region])
var _1=CALCULATE(SUM('Table'[people]),FILTER('Table','Table'[Gothenburg region]=_select&&'Table'[Year]=MAX('Table'[Year])))
return _12. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @jeseng ,
According to your description, I create this data:
Main Table:
Slice Table:
Here are the steps you can follow:
1. Create calculated column.
Year = YEAR('Table'[date])2. Create measure.
A =
var _1=
CALCULATE(SUM('Table'[people]),FILTER('Table',[region]="A"))
return
IF("A" in SELECTCOLUMNS('Slicer',"1",[Region]),_1,BLANK())B =
var _1=
CALCULATE(SUM('Table'[people]),FILTER('Table',[region]="B"))
return
IF("B" in SELECTCOLUMNS('Slicer',"1",[Region]),_1,BLANK())3. Place Year in Axis, measure A and measure B in Values, and place Region and Sex in different slicers
4. Result.
When we select Region A, only the data of A will be displayed in the line chart, and it will change with the selection of the slicer Sex
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much for taking your time with this!! But I seem to be explaining poorly 😉
I live in Gothenburg, we have 36 sub areas. I want a line chart where I can ALWAYS see the development for Gothenburg and then from a slicer choose ONE sub area. So that I always show 2 line, one that is locked (Gothenburg) and one that the user chooses.
There will also be a slicer for Age and Gender but that doesn't seem to be the main problem.
I CAN solve this in my datatable by creating a new column with the values for Gothenburg and put this on every row, so that every sub area have two values, but this will be difficult to update since I plan to collect the data via API....
Best Regards,
Jessica
@jeseng ,
Create a measure like below for a constant line:
Hi again,
When I removed the variable from "legend" I was able to put my measure in "values". The thing is, I dont want a constant line 🙂 I want to show the values for "Göteborg" as well as one more area, which my user can select from a slicer. My user also chooses Age and Gender in slicers.
Where do I put this measure?
As you can se below:
I have YEAR om my axis, then the AREA (which is in i slicer that my user can choose one area from) and the my value (from a column i my datatable) that is growth in percentage. Where do I put the measure?
@jeseng ,
Which visual are you using?
I can able to add measure under values option.
I noticed that it has to do which Legend, if I have a value i "Legend", I can only put one value in "Values"... to bad.
@jeseng , Try a measure like
calculate([measure], filter(all(Table[area]), table[area] ="Göteborg"))
But this will work better if the area is in a different table joined to this table
calculate([measure], filter(all(area), area[area] ="Göteborg"))
Okey, and where do I put this measure? 🙂
Hm, I can only have ONE value, in value?
As you can se below:
I have YEAR om my axis, then the AREA (which is in i slicer that my user can choose one area from) and the my value (from a column i my datatable) that is growth in percentage. So I dont have any other measures.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |