Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

column value comparison in Power BI

Hi,

 

I have created a Histogram and Normal distribution curve in Power BI. I want to show the Mean value in the graph.

I have created a below formula:

μ = IF('DISTRIBUCION NORMAL'[X]=ROUND([Mean_Age],0),[f(x)],0)
so that, if the value of the Mean_Age matches to the value of the 'DISTRIBUCION NORMAL'[X], then gererate the bar.
 
'DISTRIBUCION NORMAL'[X] -->  It contains series of values from 10 to 60.
Mean_Age --> Mean calculated for the Age.
 
Currently, I am able to get the bar and it is showing as below:

 

So when the Mean_age value  matches with  ''DISTRIBUCION NORMAL'[X]', it shows the f(x) value in the 'μ' column else return '0' as below:

 

but when I select any value from the filter, the mean value gets changed but in the 'μ' column, its not changing.

Please see the below example,

here, I selected, Emp Id 1 and 2, the mean value is: 14 but in the bar it's still showing as 29. It is not considering the filter selection and comparision is not happening.

 

still showing value for 29 in the data as well.

 

Does anyone have idea about this? Am I missing anything?

Thanks in advance.

 

  • Anonymous are you adding μ as column, it should be measure:

     

    μ = IF(MAX('DISTRIBUCION NORMAL'[X])=ROUND([Mean_Age],0),[f(x)],0)

     

    Ask anything Power BI. Book appointment for a free consultancy at https://www.perytus.com

     

5 Replies

  • Anonymous are you adding μ as column, it should be measure:

     

    μ = IF(MAX('DISTRIBUCION NORMAL'[X])=ROUND([Mean_Age],0),[f(x)],0)

     

    Ask anything Power BI. Book appointment for a free consultancy at https://www.perytus.com

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi parry2k,

       

      It is working perfectly. Thank you so much 🙂

       

       

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi parry2k ,

       

      Is there any way we can show 'Mean_Age' on the Data label? Currently, it is not showing the Mean value  (14) on the label.

       

      • parry2k's avatar
        parry2k
        Super User

        Anonymous it should if you have data labelled turned on.