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

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


1 ACCEPTED SOLUTION
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:

vlinyulumsft_0-1724320084615.png

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)

vlinyulumsft_1-1724320138190.png

3. Then we modify the visualization as follows:

vlinyulumsft_2-1724320164487.png

 

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

 

vlinyulumsft_3-1724320164488.png

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.

 

 

View solution in original post

4 REPLIES 4
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

becbc24a-85a5-4af2-9e99-1406278432ea.png

Thanks

 

 

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:

vlinyulumsft_0-1724320084615.png

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)

vlinyulumsft_1-1724320138190.png

3. Then we modify the visualization as follows:

vlinyulumsft_2-1724320164487.png

 

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

 

vlinyulumsft_3-1724320164488.png

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.

 

 

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-...

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/1447...

lbendlin
Super User
Super User

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

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.