Forum Discussion
conditional formatting in a column chart
HI in my monthly report where the user must select a month i have all my visual affected by that month slicer.
But i add one visual where i want to show :
the total spend from the begining of the year ( i have a measure for total spend)
so i solved it using a column chart whit de x-axis the dates from my calendar dates and in the y-axis the total spend measure and from (edit interactions) decides to not apply the selected month in that visual.
In the image there is the column chart and over a card that is in intereaction with the month slicer so it is showing the spend from JUNE .
the thing is that i want to apply a conditional formatting to show in the column chart the selected month. its posible??
- Anonymous3 years ago
Hi JUANROVALETTI ,
I suggest you to create an unrelated calendar table to help your calculation.
Unrelated DimMonth = CALCULATETABLE('Calendar')Measure:
Month Spend = VAR _SELECTYEARMONTH = SELECTEDVALUE('Unrelated DimMonth'[YearMonth]) RETURN CALCULATE(SUM('Table'[Sales]),'Calendar'[YearMonth] = _SELECTYEARMONTH)Color = VAR _SELECTMONTH = SELECTEDVALUE('Unrelated DimMonth'[MonthName]) RETURN IF(MAX('Calendar'[MonthName]) = _SELECTMONTH,"Yellow")Configure the column color as below.
Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
7 Replies
- parry2kSuper User
JUANROVALETTI you have to follow the technique used in this video, basically you need another table for the date slicer and then compare it with the main date table you are using on the x-axis and where it matches, highlight that bar using conditional formatting: Learn DAX techniques to highlight or shade data points in the visuals - Time Intelligence Power BI - YouTube
- parry2kSuper User
JUANROVALETTI you can add a measure for the selected month and then use this measure as a title of the column chart:
Selected Month = SELECTEDVALUE ( DateTable[Month Column from Slicer] )- JUANROVALETTIFrequent Visitor
okey thanks. but that's not my issue, i want the columns chart have a conditional formatting that change the color only for the selected month. but remember that i disabeled the interaction between the month slicer for the visual.
- parry2kSuper User
JUANROVALETTI I see, in the column chart you want to change the color of the bar for the selected month, correct?
- JUANROVALETTIFrequent Visitor
yes.
- AnonymousNot applicable
Hi JUANROVALETTI ,
I suggest you to create an unrelated calendar table to help your calculation.
Unrelated DimMonth = CALCULATETABLE('Calendar')Measure:
Month Spend = VAR _SELECTYEARMONTH = SELECTEDVALUE('Unrelated DimMonth'[YearMonth]) RETURN CALCULATE(SUM('Table'[Sales]),'Calendar'[YearMonth] = _SELECTYEARMONTH)Color = VAR _SELECTMONTH = SELECTEDVALUE('Unrelated DimMonth'[MonthName]) RETURN IF(MAX('Calendar'[MonthName]) = _SELECTMONTH,"Yellow")Configure the column color as below.
Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- parry2kSuper User
Anonymous Thanks for the answer but not sure why would you reply until there is a reply to my last message. What's the point? There was no feedback if my posted solution didn't work and required further solutions.