Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Redraw diagram when selecting row in matrix

I have a column diagram which has the sum of database entries on the y axis. The bars are red if negative and green if positive. When selecting a section in a related matrix the sums are filtered to only include the numbers from that section. The problem is that the old diagram is transparent with the new numbers on top instead of completely redrawing. This means that if a section has positive cash flow, the bars remain red. The code is:

 

CALCULATE(sum(ReportingDataQ[PnL]),
DimDateTime[Date] = ALLSELECTED(Overview[Date]),
FILTER(ReportingDataQ, ReportingDataQ[Section]=SELECTEDVALUE(BusinessOverview[Section], "All")),
ReportingDataQ[Live] = "2"))
 
I'd like it to just completely redraw the diagram when selecting a new section in the BusinessOverview Matrix

2 Replies

  • v-jingzhang's avatar
    v-jingzhang
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

     

    How do you set the colors of the bars? Are you using the conditional formatting formatted by Rules or Field value? 

    For example, if you format by Field value, you could create a measure like below and select this measure from the drop-down Based on field list. It will apply the colors according to the values of the measure dynamically.

    Data color = SWITCH ( TRUE (), [Measure] > 0, "Green", [Measure] < 0, "Red" )

     

    Reference: Controlling Conditional Formatting Using DAX (bluegranite.com)

     

    Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.

  • Anonymous's avatar
    Anonymous
    Not applicable

    That did unfortunately not work. The colors still only adapt dependent on the sum of all rows (ie my default value of "all") and does not change when i make a selection.