The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi there
I have a table of data which looks like this:
And I simply want to create a pie graph which shows the number of times we have undertaken each repair, e.g. Sharp edge removal = 10, Wheel repair = 11, Welding = 2, Greasing = 1
How do I do that?
Solved! Go to Solution.
Hi,lbendlin ,thanks for your concern about this issue.
Your answer is excellent!
And I would like to share some additional solutions below.
Hello,@KathyO .I am glad to help you.
As lbendlin suggested, using inverse pivot is indeed a very good way to make the data more readable!
I'd like to suggest some additional suggestions below, which I hope will be helpful to you.
suggestion1.
Create measures directly.
Count_Creasing = CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Creasing"))
Count_Welding = CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Welding"))
Count_Wheel repair = CALCULATE(COUNT('Table'[Repairs undertaken.1]),FILTER(ALL('Table'),'Table'[Repairs undertaken.1]="Wheel repair"))
Put the measures to the pie graph.
suggestion2.
If your real data does match the screenshot you've shown, it's a good idea to create a table of calculations to visualize the results.
create calculate columns to count values
Table 2 =
VAR _a = SELECTCOLUMNS(FILTER('Table','Table'[Repairs undertaken.1] = "Wheel repair"),"a",'Table'[Repairs undertaken.1])
VAR _b = SELECTCOLUMNS(FILTER('Table','Table'[Repairs undertaken.2]<>BLANK()),"a",'Table'[Repairs undertaken.2])
VAR _c = UNION(SUMMARIZECOLUMNS('Table'[Repairs undertaken.1],_a),SUMMARIZECOLUMNS('Table'[Repairs undertaken.2],_b))
RETURN
_c
values =
SWITCH(TRUE(),
'Table 2'[Repairs undertaken.1]="Wheel repair",CALCULATE(COUNT('Table'[Repairs undertaken.1]),FILTER(ALL('Table'),'Table'[Repairs undertaken.1]="Wheel repair")),
'Table 2'[Repairs undertaken.1]="Creasing",CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Creasing")),
'Table 2'[Repairs undertaken.1]="Welding",CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Welding"))
)
I've uploaded the corresponding pbix file, hope it helps.
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,lbendlin ,thanks for your concern about this issue.
Your answer is excellent!
And I would like to share some additional solutions below.
Hello,@KathyO .I am glad to help you.
As lbendlin suggested, using inverse pivot is indeed a very good way to make the data more readable!
I'd like to suggest some additional suggestions below, which I hope will be helpful to you.
suggestion1.
Create measures directly.
Count_Creasing = CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Creasing"))
Count_Welding = CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Welding"))
Count_Wheel repair = CALCULATE(COUNT('Table'[Repairs undertaken.1]),FILTER(ALL('Table'),'Table'[Repairs undertaken.1]="Wheel repair"))
Put the measures to the pie graph.
suggestion2.
If your real data does match the screenshot you've shown, it's a good idea to create a table of calculations to visualize the results.
create calculate columns to count values
Table 2 =
VAR _a = SELECTCOLUMNS(FILTER('Table','Table'[Repairs undertaken.1] = "Wheel repair"),"a",'Table'[Repairs undertaken.1])
VAR _b = SELECTCOLUMNS(FILTER('Table','Table'[Repairs undertaken.2]<>BLANK()),"a",'Table'[Repairs undertaken.2])
VAR _c = UNION(SUMMARIZECOLUMNS('Table'[Repairs undertaken.1],_a),SUMMARIZECOLUMNS('Table'[Repairs undertaken.2],_b))
RETURN
_c
values =
SWITCH(TRUE(),
'Table 2'[Repairs undertaken.1]="Wheel repair",CALCULATE(COUNT('Table'[Repairs undertaken.1]),FILTER(ALL('Table'),'Table'[Repairs undertaken.1]="Wheel repair")),
'Table 2'[Repairs undertaken.1]="Creasing",CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Creasing")),
'Table 2'[Repairs undertaken.1]="Welding",CALCULATE(COUNT('Table'[Repairs undertaken.2]),FILTER(ALL('Table'),'Table'[Repairs undertaken.2]="Welding"))
)
I've uploaded the corresponding pbix file, hope it helps.
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Why would you think a pie chart is an appropriate representation of the story you are trying to tell with the data?
Unpivot your source data to bring it into a usable format, then the chart type of your choice will "just work".
User | Count |
---|---|
77 | |
77 | |
36 | |
30 | |
28 |
User | Count |
---|---|
106 | |
97 | |
55 | |
49 | |
46 |