Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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:
I made a simple dashboard in powerBI where it shows which company scores the highest according to my weighted criteria.
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
Solved! Go to Solution.
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)
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)
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?