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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Stefaan-4365
New Member

Bar chart with true/false ratio

Hi

 

I have a table with three true/false columns, let’s call them isTested, isDeployed and isAccepted. From these columns I need to create a bar chart that shows each of these columns in two colors representing the true/false ratio. This proves to be a much more challenging than I expected, and any help would be greatly appreciated!

Thank you
Stefaan

3 REPLIES 3
v-lid-msft
Community Support
Community Support

Hi @Stefaan-4365 ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?


Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @Stefaan-4365 ,

 

We can try to create a calculated table and a measure to meet your requirement:

 

calculated table:

 

Table 2 =
CROSSJOIN (
    DATATABLE (
        "Category", STRING,
        {
            { "isTested" },
            { "isDeployed" },
            { "isAccepted" }
        }
    ),
    { TRUE (), FALSE () }
)

 

 

measure:

 

Rate =
DIVIDE (
    SWITCH (
        SELECTEDVALUE ( 'Table 2'[Category], BLANK () ),
        "isTested", CALCULATE (
            COUNTROWS ( 'Table' ),
            'Table'[isTested] IN DISTINCT ( 'Table 2'[Value] )
        ),
        "isDeployed", CALCULATE (
            COUNTROWS ( 'Table' ),
            'Table'[isDeployed] IN DISTINCT ( 'Table 2'[Value] )
        ),
        "isAccepted", CALCULATE (
            COUNTROWS ( 'Table' ),
            'Table'[isAccepted] IN DISTINCT ( 'Table 2'[Value] )
        ),
        COUNTROWS ( 'Table' )
    ),
    COUNTROWS ( 'Table' ),
    0
)

 

 

10.jpg

 


If it doesn't meet your requirement, Could you please show the exact expected result based on the tables that we have shared?


By the way, PBIX file as attached.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Stefaan-4365 , Create a common dimension with the values true and false. Join them with all three columns. One will active and two will be inactive. Use userelation to make others active

 

How to use userelation : https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

Create a color column like this

Color Date = if(FIRSTNONBLANK(Table[Value],"true") ="true","green","red")

In coditnal fomatting use it after choosing the "Field"

refer

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...

https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.