Forum Discussion
DAX dynamic format bars in column chart
- 3 years ago
Hi cottrera possible solution as following
In your Calendar / Date table insert column to create values later used in conditional formatting
Type of Month =VAR __year=YEAR('Date'[Date])VAR __month=MONTH('Date'[Date])VAR __year_month_number=__year*12+__month-1VAR __year_current=YEAR(TODAY())VAR __month_current=MONTH(TODAY())VAR __year_month_number_current=__year_current*12+__month_current-1VAR __Result=IF(__year_month_number = __year_month_number_current ,"Current month",--"#FFA500",--orangeIF(__year_month_number <__year_month_number_current ,"Month before",-- "#ff0000", --red"Future month"-- "#000000" --black))RETURN __ResultTo go to cond.formatting on bar visual put your measure (in my case it was dummy measure simple SUM (some column) and select as first picture below.
After that, go to second picture and choose format style based on rules and in part What field should we base this on? choose just created column in Calendar / Date table "Type of Month".
Choose your colour pallete as you wish.
Did I answer correctly? Kudos appreciate / accept solution.
Hi cottrera possible solution as following
In your Calendar / Date table insert column to create values later used in conditional formatting
To go to cond.formatting on bar visual put your measure (in my case it was dummy measure simple SUM (some column) and select as first picture below.
After that, go to second picture and choose format style based on rules and in part What field should we base this on? choose just created column in Calendar / Date table "Type of Month".
Choose your colour pallete as you wish.
Did I answer correctly? Kudos appreciate / accept solution.