Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Show only two colors on chart

I have a table that contains fields: company name, sales, date, rating. And a time table to her. There is also a time slicer that sets the beginning and end of the period.
I want to show on the chart the rating in comparison for two periods (the beginning and the end from the slicer). However, if I change the borders of the slaser, then the "color" of one of the columns is automatically changed. I want the two colors to stay the same (eg blue and green) no matter how the slicer moves.
Can someone tell / show how to do this?
Attached a file with an example.https://1drv.ms/u/s!AkdBRPknhBwvgqhZvHcgtU7aSoLzcA?e=PedTjV 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    Create two measures for min date and max date.

    min_ = CALCULATE(SUM('table'[Sales]),FILTER('table','table'[Date]=MIN('Date Table'[Date])))
    
    max_ = CALCULATE(SUM('table'[Sales]),FILTER('table','table'[Date]=MAX('Date Table'[Date])))

     Then create a visual as below.

     

    Best Regards,

    Jay

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Create two measures for min date and max date.

    min_ = CALCULATE(SUM('table'[Sales]),FILTER('table','table'[Date]=MIN('Date Table'[Date])))
    
    max_ = CALCULATE(SUM('table'[Sales]),FILTER('table','table'[Date]=MAX('Date Table'[Date])))

     Then create a visual as below.

     

    Best Regards,

    Jay

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks it that i need.

      But in this case if dont have date in table1 ( that in slicer of date table), then it is not shown on chart.  Can measure take nearly date ?

      ( For example if in slicer period( from 01.03.2021 to 10.03.2021),and in table  in 03.2021  is near date 02.03.2021, than it show on chart: 02.03.2021 and 10.03.2021.

      Any idea?