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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.