Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Create a pie chart for line items with multiple tags (binary in nature 1,0)

I have a dataset which looks like this.

Item No.Category ACategory BValue
111110$1000
222211$2000
33301$3000
444411$2000

I want to create a pie chart which populates the values of both category A and B. 

 

ValtteriN 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Create calculated table.

    Table 2 =
    SUMMARIZE('Table','Table'[Item No.],
    "CategoryA 1",CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category A]=1)),
    "CategoryA 0",CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category A]=0)),
    "CategoryB 1",CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category B]=1)),
    "CategoryB 0",CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category B]=0))
    )

    2. Result:

    All set to Max.

    Please click here for the pbix file

     

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

3 Replies

  • Anonymous , What will the legend.

    If you have two measures category A and Category B, then you can have pie on that without legend.

     

    You can unpivot Category A and Category B use the new column as Legend, the 1/0 column as details and value as value

  • ValtteriN's avatar
    ValtteriN
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous ,

    Like Amit mentioned you should look into unpivoting the data into a format where you have a category column describing if a row belong to A or B category then use the binary data as the value.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Create calculated table.

    Table 2 =
    SUMMARIZE('Table','Table'[Item No.],
    "CategoryA 1",CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category A]=1)),
    "CategoryA 0",CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category A]=0)),
    "CategoryB 1",CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category B]=1)),
    "CategoryB 0",CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Category B]=0))
    )

    2. Result:

    All set to Max.

    Please click here for the pbix file

     

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly