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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
lottie2404
Frequent Visitor

Help with the dummy variable

Previously in stata, a variable was generated with the name "indicator" which is a dummy. It is zero when the school does not need repair and 1 when it does.

I would like to generate a bar chart showing the schools in need of repair (1) and the total number of schools (the total of the variable ind_01), as well as the percentage of schools in need of repair.

Please, if you could give me a guide, because I am new.

 

I have my database as follows

 

id_schoolstateind_01
2345Alabama0
2334New York1
1222Alabama0
6778Los Angeles0
4455New York1
3345New York1

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lottie2404 ,

 

You can create measures as follows.

Need repair = CALCULATE(COUNT('Table'[id_school]),FILTER(ALLSELECTED('Table'),[ind_01]=1))
Not need repair = CALCULATE(COUNT('Table'[id_school]),FILTER(ALLSELECTED('Table'),[ind_01]=0))
Total = CALCULATE(COUNT('Table'[id_school]),ALLSELECTED('Table'))

vstephenmsft_0-1676860252478.png

About the percentage of schools in need of repair, create as follows.

Percentage of schools in need of repair = DIVIDE([Need repair],[Total])

vstephenmsft_1-1676860389935.png

 

   

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

1 REPLY 1
Anonymous
Not applicable

Hi @lottie2404 ,

 

You can create measures as follows.

Need repair = CALCULATE(COUNT('Table'[id_school]),FILTER(ALLSELECTED('Table'),[ind_01]=1))
Not need repair = CALCULATE(COUNT('Table'[id_school]),FILTER(ALLSELECTED('Table'),[ind_01]=0))
Total = CALCULATE(COUNT('Table'[id_school]),ALLSELECTED('Table'))

vstephenmsft_0-1676860252478.png

About the percentage of schools in need of repair, create as follows.

Percentage of schools in need of repair = DIVIDE([Need repair],[Total])

vstephenmsft_1-1676860389935.png

 

   

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors