Forum Discussion

jbc22's avatar
jbc22
Frequent Visitor
7 years ago
Solved

Slicer to Change Column Donut Chart Utilizes

Hi,   I am attempting to develop a report where based on the select in a slicer, the column on which a donut chart is based, changes.    For example, lets say we have a table like the below. Base...
  • AnthonyTilley's avatar
    7 years ago

    okay slightly diffrent to what was in the orginal.

     

    the way i gave you is to swap the value in the filed but you want to swap the dimention 

     

    For this you need a 3rd table called catagories as below

    Catagories

    5 - 10
    <5
    >10

     

    this will then be joined to both your sales and cost cat colunms (make both joins non active)

     

     

    then use the measure below 

    Measure = 
    var sv = SELECTEDVALUE(table2[Type])
    var c = CALCULATE(count(Table1[COSTS CAT]),USERELATIONSHIP('Table'[Catagories],Table1[COSTS CAT]))
    var s = CALCULATE(count(Table1[SALES CAT]),USERELATIONSHIP('Table'[Catagories],Table1[SALES CAT]))
    
    var ret = SWITCH(sv,
                        "Sales",s,
                        "Costs",c
                        ,0)
    Return ret

    simply put this is doing the same as before looking at the selected value in the none joined type table and then will swap between two measures "s" and "c" these two measures will do a count of the costs cat and sales cat Filed and will switch the join based on the relation ship that is needed 

     

    the out come is below