weizer
weizer

Reputation: 1117

How to create line chart in PowerBI when the value is a text (Ok, Incorrect)?

enter image description here

Hi everyone,

I want to plot the line chart above in PowerBI based on the data that I have in column A,B and C. The challenge that I have is that the Values of the line chart only able to show as Percent of grand total instead of Percent of row/column total.

I'm still new to PowerBI, not sure any new measure that I can use to create the line chart above.

enter image description here

The line chart above is what I'm able to create in PowerBI, may I know what should I do to change the y-axis into percentage (percentage of OK for Mar + percentage of Incorrect for Mar = 100%) ? Any help will be greatly appreciated!

Upvotes: 2

Views: 1108

Answers (1)

mkRabbani
mkRabbani

Reputation: 16908

First create these below 3 measure-

total_student = DISTINCTCOUNT(your_table_name[Name])
ok_% = 

VAR OK_COUNT = COUNTROWS(
    FILTER(
        your_table_name,
        your_table_name[Answer] = "ok"
    )
)

RETURN (OK_COUNT/your_table_name[total_student])
incorrect_% = 

VAR incorrect_count = COUNTROWS(
    FILTER(
        your_table_name,
        your_table_name[Answer] = "incorrect"
    )
)

RETURN (incorrect_count/your_table_name[total_student])

Now convert last 2 measure as % and create your chart. Here below I have created everything for first 2 month from your sample data-

enter image description here

Note Your Month field need proper ordering for correct output.

Upvotes: 1

Related Questions