Forum Discussion

BrunoT's avatar
BrunoT
Frequent Visitor
1 year ago
Solved

Horizontal bar chart with multiple measures/colums

Hi, 

I got a table like this:

USER_IDQuestion 1Question 2Question 3Question 4
FR_20250501_24YesYesYesNo
FR_20250501_29NoNoYesYes
FR_20250501_144YesYesNoNo
FR_20250501_67NoNoNoNo
FR_20250501_64NoYesYesNo
FR_20250501_27NoNoYesYes
FR_20250501_159YesYesNoYes
FR_20250501_134NoNoYesNo
FR_20250501_68YesYesYesYes
FR_20250501_77NoYesNoYes


And I would build a horizontal barchart like this:

Where each bar is the percentage of users saying Yes:

 YesNo
Question 140%60%
Question 260%40%
Question 360%40%
Question 450%50%

 

I created 4 measures like:

Q1_Yes = 
DIVIDE(
    CALCULATE(
        DISTINCTCOUNT(DATA[USER_ID]),
        DATA[Question 1] = "Yes"
    ),
    DISTINCTCOUNT(DATA[USER_ID])
)

Is it the right approach?

Probably I scould use a measures with VAR and RETURNS or an SVG,  could you help me?

 

6 Replies

  • Turn your table to this:

     

    And then do this

    YES =
    DIVIDE
    (
        CALCULATE(
           COUNTROWS('Table'),
            'Table'[Value] = "YES"
        ),
        COUNTROWS('Table')
    )
     
    And this

     

    • v-saisrao-msft's avatar
      v-saisrao-msft
      Community Support

      Hi BrunoT,
      I wanted to check if you had the opportunity to review the information provided by Ashish_Mathur Tutu_in_YYC . Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
      Thank you.

    • v-saisrao-msft's avatar
      v-saisrao-msft
      Community Support

      Hi BrunoT,

      May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

      Thank you.

    • v-saisrao-msft's avatar
      v-saisrao-msft
      Community Support

      Hi BrunoT,

       

      We haven’t heard back from you regarding your issue. If it has been resolved, please mark the helpful response as the solution and give a ‘Kudos’ to assist others. If you still need support, let us know.

       

      Thank you.