Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

slicers for weighted column

Hey community! I hope there is someone out there who can help me with this problem. I will try to explain it as clear as possible.

 

I am currently building an assesment model to analyse companies by a set of criteria. In Rstudio I made a simple data frame with those criteria (normalised) and created a column called "score" where i weighted these criteria. the calculation is really simple:

 

```{r weigh criteria}
DF$score<- (DF$reviews*25) + (DF$visits*25) + (DF$desirability*20) + (DF$followercount*15) + (DF$tweets*5) + (DF$size*5) #assigning weights
```

here is what the dataframe looks like:

robin_wijs_0-1637661161803.png

 

I made a simple dashboard in powerBI where it shows which company scores the highest according to my weighted criteria.

PAM0.5.pdf

now here is my question: 

instead of having a column with static data, I want to have slicers on my report where users can modify the weights per criteria, and the score gets affected by it. I tried making a new slicer and use DAX to make a "what if" function, but when I got the error that the value is not agrregated. i don't want the value to be aggregated because the data points are unique per company. but maybe I'm going about this the complete wrong way. I have experience in R, but this is the first time making a report in Power BI

I appreciate all your tips and feedback! 

Kind regards 

 

 

 

Use what-if parameters to visualize variables - Power BI | Microsoft Docs

 

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

Sounds like you should use the SELECTEDVALUE function to get the value the user has selected from the slicer.

So, something like:

Score = 
VAR _ReviewWeight = SELECTEDVALUE('Review Weight'[Weight])
// etc for all weights
VAR _Result = 
SUMX(
    'Table',
    ('Table'[reviews * _ReviewWeight) + etc..
)
RETURN
    _Result

You can have a second parameter in SELECTEDVALUE, which is the value to use when the user doesn;t make a selection.  You could set that to your default values.

VAR _ReviewWeight = SELECTEDVALUE('Review Weight'[Weight], 25)

 

View solution in original post

2 REPLIES 2
PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

Sounds like you should use the SELECTEDVALUE function to get the value the user has selected from the slicer.

So, something like:

Score = 
VAR _ReviewWeight = SELECTEDVALUE('Review Weight'[Weight])
// etc for all weights
VAR _Result = 
SUMX(
    'Table',
    ('Table'[reviews * _ReviewWeight) + etc..
)
RETURN
    _Result

You can have a second parameter in SELECTEDVALUE, which is the value to use when the user doesn;t make a selection.  You could set that to your default values.

VAR _ReviewWeight = SELECTEDVALUE('Review Weight'[Weight], 25)

 

Anonymous
Not applicable

Can you give a little context on some of these variables? Like how do we include the weight column in this DAX if the weight hasn't been selected by user?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.