The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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_school | state | ind_01 |
2345 | Alabama | 0 |
2334 | New York | 1 |
1222 | Alabama | 0 |
6778 | Los Angeles | 0 |
4455 | New York | 1 |
3345 | New York | 1 |
Solved! Go to Solution.
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'))
About the percentage of schools in need of repair, create as follows.
Percentage of schools in need of repair = DIVIDE([Need repair],[Total])
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.
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'))
About the percentage of schools in need of repair, create as follows.
Percentage of schools in need of repair = DIVIDE([Need repair],[Total])
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.