Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Power Bi

Hi 

I need to create a couple of measures in my desktop and these measures my be increased based on the values being added to one of the fileds of my database. My question is that if there is way to write a script that when a new value is added to that file of database, a measure is created for this new value?
Here is a example of my database table (my_table):

projectip_program
XX_ip1
XX_ip2

The measures for these to ip_programs should be somthing like this:

X_ip1_count= CALCULATE(COUNT('my_table'[ip_program]), FILTER('my_table','my_table'[projectip_program]=" X_ip1"))
X_ip2_count= CALCULATE(COUNT('my_table'[ip_program]), FILTER('my_table','my_table'[projectip_program]=" X_ip2"))
I want to have this measure creation in a code to make it possible to check any new value in the ip_program field and create the new measures for new values automatically.
Thanks,
Maryam


  • Anonymous's avatar
    Anonymous
    2 years ago

    Thanks for the reply from lbendlin , please allow me to provide another insight:

    Hi, Anonymous 

    Regarding the issue you raised, my solution is as follows:

    1.First I have created the following table and the column names and data are the data you have given:

    2.only need to ensure that the same color and classification are consistent, and the modification I made to my data is to create the following calculation columns:

    Column = RIGHT('Table'[ip_program],3)

    3. Then we modify the visualization as follows:

     

    4.Here's my final result, which I hope meets your requirements.

     

    Please find the attached pbix relevant to the case.

     
    Of course, if you have any new ideas, you are welcome to contact us.
     

    Best Regards,

    Leroy Lu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

4 Replies

  • No need to create tons of explicit measures. Add [projectip_program] to the visual as dimension and then use implicit measures.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks lbendlin for the response. In fact, in my table, project and ip_program are two seperate columns. So it is not one field named "projectip_program".

    Projectip_program
    xx_ip1
    xx_ip2
    xx_ip3


    My reason to create  measures is that I want to use a stacked bar chart for my visualization showing the total number of ip programs, color coded with each of the ip-program name. For this scenario if you have any recommendation rather than using measure? Here I attach an image example of my chart in which each color represents an ip_program name

    Thanks

     

     

    • lbendlin's avatar
      lbendlin
      Super User

      Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

      Do not include sensitive information or anything not related to the issue or question.

      If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216

      Please show the expected outcome based on the sample data you provided.

      Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for the reply from lbendlin , please allow me to provide another insight:

      Hi, Anonymous 

      Regarding the issue you raised, my solution is as follows:

      1.First I have created the following table and the column names and data are the data you have given:

      2.only need to ensure that the same color and classification are consistent, and the modification I made to my data is to create the following calculation columns:

      Column = RIGHT('Table'[ip_program],3)

      3. Then we modify the visualization as follows:

       

      4.Here's my final result, which I hope meets your requirements.

       

      Please find the attached pbix relevant to the case.

       
      Of course, if you have any new ideas, you are welcome to contact us.
       

      Best Regards,

      Leroy Lu

      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.